florist-gpl-2017-src/0000755000076700001450000000000013106553473014016 5ustar gnatmailgnatflorist-gpl-2017-src/COPYING0000644000076700001450000004310606602140742015047 0ustar gnatmailgnat GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. florist-gpl-2017-src/configure0000755000076700001450000050645512442527764015752 0ustar gnatmailgnat#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="libsrc/posix.adb" ac_subst_vars='LTLIBOBJS LIBOBJS EGREP GREP CPP RTS_OPTION BUILD_TYPE_OPTION LIBRARY_TYPE_OPTION DEPS THREADS_OPTION SIGNALS_GENERATED OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_threads enable_shared with_build_type with_rts ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-threads Do not try to build pthread support --enable-shared Enable build of shared libraries Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-build-type=X Set build type (Production/Debug) --with-rts=X Set RTS Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo See file "configure.log" for results of this step. # specifies some well-known file in the configured directory ac_config_headers="$ac_config_headers confsrc/config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu rm -f pconfig.h # Check whether --enable-threads was given. if test "${enable_threads+set}" = set; then : enableval=$enable_threads; else use_pthread=yes fi if test "x$use_pthread" = "xyes" ; then DEPS=deps SIGNALS_GENERATED=posix-implementation-ok_signals.ads THREADS_BOOL=True else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No pthread support." >&5 $as_echo "$as_me: WARNING: No pthread support." >&2;} DEPS=deps_no_thread SIGNALS_GENERATED= THREADS_BOOL=False fi THREADS_OPTION=-XTHREADS=${THREADS_BOOL} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build a shared library" >&5 $as_echo_n "checking whether to build a shared library... " >&6; } # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 $as_echo "$enableval" >&6; } if test "$enableval" = "yes"; then LIBRARY_TYPE_OPTION="-XLIBRARY_TYPE=relocatable" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking build type" >&5 $as_echo_n "checking build type... " >&6; } # Check whether --with-build-type was given. if test "${with_build_type+set}" = set; then : withval=$with_build_type; case "x$with_build_type" in xyes|xno) as_fn_error $? "invalid build type" "$LINENO" 5 ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_build_type" >&5 $as_echo "$with_build_type" >&6; } BUILD_TYPE_OPTION="-XBuild=$with_build_type" ;; esac else { $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5 $as_echo "default" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking RTS kind" >&5 $as_echo_n "checking RTS kind... " >&6; } # Check whether --with-rts was given. if test "${with_rts+set}" = set; then : withval=$with_rts; case "x$with_rts" in xyes|xno) as_fn_error $? "invalid RTS" "$LINENO" 5 ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_rts" >&5 $as_echo "$with_rts" >&6; } RTS_OPTION="--RTS=$with_rts" ;; esac else { $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5 $as_echo "default" >&6; } fi # By default errno is preserved accross exceptions safe_errno=True echo $ac_n "checking for SGI IRIX timers... " $ac_c; if (grep "CLOCK_SGI_FAST" /usr/include/sys/ptimers.h >/dev/null 2>&1); then echo "yes" echo "HAVE_IRIX_Timers := True" >> gnatprep.config; else echo "no" echo "HAVE_IRIX_Timers := False" >> gnatprep.config; fi; UNAME_MACHINE=`(uname -m) 2>/dev/null` UNAME_RELEASE=`(uname -r) 2>/dev/null` UNAME_SYSTEM=`(uname -s) 2>/dev/null` UNAME_VERSION=`(uname -v) 2>/dev/null` echo ${UNAME_SYSTEM} ${UNAME_MACHINE} ${UNAME_RELEASE} ${UNAME_VERSION} case ${UNAME_SYSTEM} in HP-UX) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; case ${UNAME_RELEASE} in B.10.*) echo "making Config" cp ./configs/pconfig.HP-UX10.x ./pconfig.h.in; ;; B.11.*) echo "making Config" # getenv might be called during propagation, and modifies errno. safe_errno=False cp ./configs/pconfig.HP-UX11.00 ./pconfig.h.in; ;; *) echo "Unexpected HP-UX release; using default." cp ./configs/pconfig.Default ./pconfig.h.in; ;; esac; ;; SunOS) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; case ${UNAME_RELEASE} in 5.1[0-9]) cp ./configs/pconfig.SunOS5.10 ./pconfig.h.in ;; *) cp ./configs/pconfig.SunOS5.6 ./pconfig.h.in ;; esac ;; Linux) # .... need to add cases here for different thread and C libraries echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; cp ./configs/pconfig.Linux ./pconfig.h.in; ;; OSF1) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; case `gcc -dumpmachine` in *-*-osf4.0[bc]) cp ./configs/pconfig.OSF1-4.0b ./pconfig.h.in; ;; *-*-osf4.0[d-z] | *-*-osf4.[1-9]* | *-*-osf5* ) cp ./configs/pconfig.OSF1 ./pconfig.h.in; ;; esac ;; IRIX*) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; cp ./configs/pconfig.IRIX6.x ./pconfig.h.in; ;; AIX) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_VERSION}; case `gcc -dumpmachine` in *-*-aix4*) cp ./configs/pconfig.AIX4.1 ./pconfig.h.in; ;; *-*-aix[567]*) cp ./configs/pconfig.AIX5.x ./pconfig.h.in; ;; esac ;; UnixWare) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; cp ./configs/pconfig.UnixWare ./pconfig.h.in; ;; LynxOS) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; cp ./configs/pconfig.LynxOS ./pconfig.h.in; ;; FreeBSD) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; cp ./configs/pconfig.FreeBSD ./pconfig.h.in; ;; Darwin) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; cp ./configs/pconfig.Darwin ./pconfig.h.in; ;; *) echo "No Configuration for ${UNAME_SYSTEM}. Using default."; cp ./configs/pconfig.Default ./pconfig.h.in; ;; esac; if test "x$safe_errno" = "xTrue" ; then safe_errno_msg="safe" else safe_errno_msg="not safe" fi echo "We will assume errno is $safe_errno_msg for exception propagation." echo "to override, hand-edit gnatprep.config" echo "HAVE_Safe_Errno := $safe_errno" >> gnatprep.config; # defines HAVE_NAME_H for each header "name.h" found # also checks for location of Pthread library # note that the order is rather touchy # for Solaris 2.5.1, utsname.h must precede limits.h # for Solaris 2.5.1, netinet/in.h must preceded arpa/inet.h # for Linux 2.0.x with Provenzano (MIT) threads, # pthread.h must follow sched.h, since # pthread.h redefines symbols in sched.h; # the effect is to detect the problem and drop pthread.h ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu rm -f confsrc/pconfig.h cp pconfig.h.in confsrc/pconfig.h chmod 644 confsrc/pconfig.h if ( test ! -f confsrc/pconfig.h ) then as_fn_error $? "missing confsrc/pconfig.h" "$LINENO" 5; fi for ac_hdr in \ aio.h\ dirent.h\ errno.h\ fcntl.h\ grp.h\ locale.h\ mqueue.h\ pwd.h\ sched.h\ pthread.h\ semaphore.h\ setjmp.h\ signal.h\ stdio.h\ sys/mman.h\ sys/stat.h\ sys/times.h\ sys/types.h\ sys/utsname.h\ limits.h\ sys/wait.h\ termios.h\ time.h\ sys/time.h\ unistd.h\ utime.h\ do ac_old_cflags=$CFLAGS # CFLAGS="$CFLAGS -Werror" ac_safe=`echo "$ac_hdr" | tr './\055' '___'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr" >&5 $as_echo_n "checking for $ac_hdr... " >&6; } if eval \${ac_cv_header_$ac_safe+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$ac_hdr> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" #include <$ac_hdr> int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "ac_cv_header_$ac_safe=yes" else eval "ac_cv_header_$ac_safe=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else eval "ac_cv_header_$ac_safe=no" fi rm -f conftest.err conftest.i conftest.$ac_ext fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } echo "#include <$ac_hdr>" >> confsrc/pconfig.h ac_tr_hdr=HAVE_$(echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___') cat >>confdefs.h <<_ACEOF #define $ac_tr_hdr 1 _ACEOF else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi CFLAGS=$ac_old_cflags done # POSIX.5c headers are separated, because we want to do # some special processing to try to substitute for missing standard # header files. # Checks for xti.h and tli.h are built-in, as is check for whether we # need addrinfo.h. # We always call this after AC_POSIX_HEADERS, so that pconfig.h will # already have the other required POSIX headers in it, and in particular # will have any lines inherited from pconfig.h.in. for ac_hdr in netdb.h\ netinet/in.h\ netinet/in_systm.h\ netinet/ip.h\ netinet/tcp.h\ arpa/inet.h\ poll.h\ sys/select.h\ sys/socket.h\ sys/uio.h\ sys/un.h\ do ac_old_cflags=$CFLAGS # CFLAGS="$CFLAGS -Werror" ac_safe=`echo "$ac_hdr" | tr './\055' '___'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr" >&5 $as_echo_n "checking for $ac_hdr... " >&6; } if eval \${ac_cv_header_$ac_safe+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$ac_hdr> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" #include <$ac_hdr> int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "ac_cv_header_$ac_safe=yes" else eval "ac_cv_header_$ac_safe=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else eval "ac_cv_header_$ac_safe=no" fi rm -f conftest.err conftest.i conftest.$ac_ext fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } echo "#include <$ac_hdr>" >> confsrc/pconfig.h ac_tr_hdr=HAVE_$(echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___') cat >>confdefs.h <<_ACEOF #define $ac_tr_hdr 1 _ACEOF else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi CFLAGS=$ac_old_cflags done ac_old_cflags=$CFLAGS # CFLAGS="$CFLAGS -Werror" ac_safe=`echo "xti.h" | tr './\055' '___'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xti.h" >&5 $as_echo_n "checking for xti.h... " >&6; } if eval \${ac_cv_header_$ac_safe+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "ac_cv_header_$ac_safe=yes" else eval "ac_cv_header_$ac_safe=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else eval "ac_cv_header_$ac_safe=no" fi rm -f conftest.err conftest.i conftest.$ac_ext fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } echo "#include " >> confsrc/pconfig.h cat >>confdefs.h <<_ACEOF #define HAVE_XTI_H 1 _ACEOF echo "-- don't want TLI because we have xti.h TLI := False" >> gnatprep.config; else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ac_old_cflags=$CFLAGS # CFLAGS="$CFLAGS -Werror" ac_safe=`echo "tli.h" | tr './\055' '___'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tli.h" >&5 $as_echo_n "checking for tli.h... " >&6; } if eval \${ac_cv_header_$ac_safe+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "ac_cv_header_$ac_safe=yes" else eval "ac_cv_header_$ac_safe=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else eval "ac_cv_header_$ac_safe=no" fi rm -f conftest.err conftest.i conftest.$ac_ext fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } echo "#include " >> confsrc/pconfig.h cat >>confdefs.h <<_ACEOF #define HAVE_TLI_H 1 _ACEOF echo "-- using TLI because could not find xti.h TLI := True" >> gnatprep.config; else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } echo "-- could not find tli.h TLI := False" >> gnatprep.config; fi CFLAGS=$ac_old_cflags fi CFLAGS=$ac_old_cflags cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" int main () { struct msghdr hdr; hdr.msg_controllen = 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo "Socket interface looks like BSD 4.4"; # Put BSD flag in gnatprep.config if (grep BSD4_3 gnatprep.config >/dev/null 2>&1); then true; else (echo "-- set BSD4_3 to False if using 4.4 style socket msghdr"; echo "BSD4_3 := False") >> gnatprep.config; fi; if (grep _BSD4_4_ confsrc/pconfig.h >/dev/null 2>&1); then true; else echo "#define _BSD4_4_" >> confsrc/pconfig.h; fi; else echo "Socket interface Looks like BSD 4.3"; if (grep BSD4_3 gnatprep.config >/dev/null 2>&1); then true; else (echo "-- set BSD4_3 to False if using 4.4 style socket msghdr"; echo "BSD4_3 := True") >> gnatprep.config; fi; if (grep _BSD4_3_ confsrc/pconfig.h >/dev/null 2>&1); then true; else echo "#define _BSD4_3_" >> confsrc/pconfig.h; fi; fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if (grep xti.h confsrc/pconfig.h >/dev/null 2>&1); then if (grep _XTI_ confsrc/pconfig.h >/dev/null 2>&1); then true; else echo "#define _XTI_" >> confsrc/pconfig.h; fi ; else if [ -f /usr/include/sys/tiuser.h ]; then echo "Have only TLI, will use that in place of XTI"; if (grep _TLI_ confsrc/pconfig.h >/dev/null 2>&1); then true; else echo "#define _TLI_" >> confsrc/pconfig.h; echo "#include " >> confsrc/pconfig.h; fi; fi; fi if test "x$use_pthread" = "xyes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 $as_echo_n "checking for pthread_self in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_self+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_self (); int main () { return pthread_self (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_self=yes else ac_cv_lib_pthread_pthread_self=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_self" >&5 $as_echo "$ac_cv_lib_pthread_pthread_self" >&6; } if test "x$ac_cv_lib_pthread_pthread_self" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF LIBS="-lpthread $LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_self in -lpthread" >&5 $as_echo_n "checking for __pthread_self in -lpthread... " >&6; } if ${ac_cv_lib_pthread___pthread_self+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char __pthread_self (); int main () { return __pthread_self (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread___pthread_self=yes else ac_cv_lib_pthread___pthread_self=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread___pthread_self" >&5 $as_echo "$ac_cv_lib_pthread___pthread_self" >&6; } if test "x$ac_cv_lib_pthread___pthread_self" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF LIBS="-lpthread $LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthreads" >&5 $as_echo_n "checking for pthread_self in -lpthreads... " >&6; } if ${ac_cv_lib_pthreads_pthread_self+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthreads $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_self (); int main () { return pthread_self (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthreads_pthread_self=yes else ac_cv_lib_pthreads_pthread_self=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_pthread_self" >&5 $as_echo "$ac_cv_lib_pthreads_pthread_self" >&6; } if test "x$ac_cv_lib_pthreads_pthread_self" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREADS 1 _ACEOF LIBS="-lpthreads $LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lcma" >&5 $as_echo_n "checking for pthread_self in -lcma... " >&6; } if ${ac_cv_lib_cma_pthread_self+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcma $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_self (); int main () { return pthread_self (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_cma_pthread_self=yes else ac_cv_lib_cma_pthread_self=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cma_pthread_self" >&5 $as_echo "$ac_cv_lib_cma_pthread_self" >&6; } if test "x$ac_cv_lib_cma_pthread_self" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBCMA 1 _ACEOF LIBS="-lcma $LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -l:libcma.a" >&5 $as_echo_n "checking for pthread_self in -l:libcma.a... " >&6; } if ${ac_cv_lib__libcma_a_pthread_self+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-l:libcma.a $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_self (); int main () { return pthread_self (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib__libcma_a_pthread_self=yes else ac_cv_lib__libcma_a_pthread_self=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib__libcma_a_pthread_self" >&5 $as_echo "$ac_cv_lib__libcma_a_pthread_self" >&6; } if test "x$ac_cv_lib__libcma_a_pthread_self" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIB_LIBCMA_A 1 _ACEOF LIBS="-l:libcma.a $LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lthread" >&5 $as_echo_n "checking for pthread_self in -lthread... " >&6; } if ${ac_cv_lib_thread_pthread_self+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_self (); int main () { return pthread_self (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_thread_pthread_self=yes else ac_cv_lib_thread_pthread_self=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_thread_pthread_self" >&5 $as_echo "$ac_cv_lib_thread_pthread_self" >&6; } if test "x$ac_cv_lib_thread_pthread_self" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBTHREAD 1 _ACEOF LIBS="-lthread $LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lc_r" >&5 $as_echo_n "checking for pthread_self in -lc_r... " >&6; } if ${ac_cv_lib_c_r_pthread_self+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_self (); int main () { return pthread_self (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_c_r_pthread_self=yes else ac_cv_lib_c_r_pthread_self=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_self" >&5 $as_echo "$ac_cv_lib_c_r_pthread_self" >&6; } if test "x$ac_cv_lib_c_r_pthread_self" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBC_R 1 _ACEOF LIBS="-lc_r $LIBS" fi fi fi fi fi fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for aio_read in -laio" >&5 $as_echo_n "checking for aio_read in -laio... " >&6; } if ${ac_cv_lib_aio_aio_read+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-laio $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char aio_read (); int main () { return aio_read (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_aio_aio_read=yes else ac_cv_lib_aio_aio_read=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_aio_aio_read" >&5 $as_echo "$ac_cv_lib_aio_aio_read" >&6; } if test "x$ac_cv_lib_aio_aio_read" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBAIO 1 _ACEOF LIBS="-laio $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lposix4" >&5 $as_echo_n "checking for clock_gettime in -lposix4... " >&6; } if ${ac_cv_lib_posix4_clock_gettime+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix4 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char clock_gettime (); int main () { return clock_gettime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_posix4_clock_gettime=yes else ac_cv_lib_posix4_clock_gettime=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_clock_gettime" >&5 $as_echo "$ac_cv_lib_posix4_clock_gettime" >&6; } if test "x$ac_cv_lib_posix4_clock_gettime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPOSIX4 1 _ACEOF LIBS="-lposix4 $LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 $as_echo_n "checking for clock_gettime in -lrt... " >&6; } if ${ac_cv_lib_rt_clock_gettime+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char clock_gettime (); int main () { return clock_gettime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_rt_clock_gettime=yes else ac_cv_lib_rt_clock_gettime=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 $as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBRT 1 _ACEOF LIBS="-lrt $LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if ${ac_cv_lib_nsl_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_gethostbyname=yes else ac_cv_lib_nsl_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 _ACEOF LIBS="-lnsl $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for t_bind in -lnsl" >&5 $as_echo_n "checking for t_bind in -lnsl... " >&6; } if ${ac_cv_lib_nsl_t_bind+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char t_bind (); int main () { return t_bind (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_t_bind=yes else ac_cv_lib_nsl_t_bind=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_t_bind" >&5 $as_echo "$ac_cv_lib_nsl_t_bind" >&6; } if test "x$ac_cv_lib_nsl_t_bind" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 _ACEOF LIBS="-lnsl $LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for t_bind in -lnsl_s" >&5 $as_echo_n "checking for t_bind in -lnsl_s... " >&6; } if ${ac_cv_lib_nsl_s_t_bind+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl_s $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char t_bind (); int main () { return t_bind (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_s_t_bind=yes else ac_cv_lib_nsl_s_t_bind=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_s_t_bind" >&5 $as_echo "$ac_cv_lib_nsl_s_t_bind" >&6; } if test "x$ac_cv_lib_nsl_s_t_bind" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL_S 1 _ACEOF LIBS="-lnsl_s $LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for accept in -lsocket" >&5 $as_echo_n "checking for accept in -lsocket... " >&6; } if ${ac_cv_lib_socket_accept+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char accept (); int main () { return accept (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_accept=yes else ac_cv_lib_socket_accept=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_accept" >&5 $as_echo "$ac_cv_lib_socket_accept" >&6; } if test "x$ac_cv_lib_socket_accept" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF LIBS="-lsocket $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for h_errno in -lresolv" >&5 $as_echo_n "checking for h_errno in -lresolv... " >&6; } if ${ac_cv_lib_resolv_h_errno+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lresolv $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char h_errno (); int main () { return h_errno (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_resolv_h_errno=yes else ac_cv_lib_resolv_h_errno=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_h_errno" >&5 $as_echo "$ac_cv_lib_resolv_h_errno" >&6; } if test "x$ac_cv_lib_resolv_h_errno" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBRESOLV 1 _ACEOF LIBS="-lresolv $LIBS" fi echo "Using LIBS=${LIBS}" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for global variable or macro t_errno" >&5 $as_echo_n "checking for global variable or macro t_errno... " >&6; } if ${ac_cv_comp_t_errno+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "t_errno" >/dev/null 2>&1; then : eval "ac_cv_comp_t_errno=yes" else eval "ac_cv_comp_t_errno=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_comp_'t_errno`\" = yes"; then cat >>confdefs.h <<_ACEOF #define HAVE_t_errno 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for global variable or macro t_nerr" >&5 $as_echo_n "checking for global variable or macro t_nerr... " >&6; } if ${ac_cv_comp_t_nerr+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "t_nerr" >/dev/null 2>&1; then : eval "ac_cv_comp_t_nerr=yes" else eval "ac_cv_comp_t_nerr=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_comp_'t_nerr`\" = yes"; then cat >>confdefs.h <<_ACEOF #define HAVE_t_nerr 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct msghdr component msg_control" >&5 $as_echo_n "checking for struct msghdr component msg_control... " >&6; } if ${ac_cv_comp_msg_control+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" struct msghdr x; int main () { x.msg_control = x.msg_control; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "ac_cv_comp_msg_control=yes" else eval "ac_cv_comp_msg_control=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if eval "test \"`echo '$ac_cv_comp_'msg_control`\" = yes"; then cat >>confdefs.h <<_ACEOF #define HAVE_component_msg_control 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct msghdr component msg_controllen" >&5 $as_echo_n "checking for struct msghdr component msg_controllen... " >&6; } if ${ac_cv_comp_msg_controllen+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" struct msghdr x; int main () { x.msg_controllen = x.msg_controllen; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "ac_cv_comp_msg_controllen=yes" else eval "ac_cv_comp_msg_controllen=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if eval "test \"`echo '$ac_cv_comp_'msg_controllen`\" = yes"; then cat >>confdefs.h <<_ACEOF #define HAVE_component_msg_controllen 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct msghdr component msg_flags" >&5 $as_echo_n "checking for struct msghdr component msg_flags... " >&6; } if ${ac_cv_comp_msg_flags+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" struct msghdr x; int main () { x.msg_flags = x.msg_flags; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "ac_cv_comp_msg_flags=yes" else eval "ac_cv_comp_msg_flags=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if eval "test \"`echo '$ac_cv_comp_'msg_flags`\" = yes"; then cat >>confdefs.h <<_ACEOF #define HAVE_component_msg_flags 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sigevent component sigev_notify_function" >&5 $as_echo_n "checking for struct sigevent component sigev_notify_function... " >&6; } if ${ac_cv_comp_sigev_notify_function+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" struct sigevent x; int main () { x.sigev_notify_function = x.sigev_notify_function; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "ac_cv_comp_sigev_notify_function=yes" else eval "ac_cv_comp_sigev_notify_function=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if eval "test \"`echo '$ac_cv_comp_'sigev_notify_function`\" = yes"; then cat >>confdefs.h <<_ACEOF #define HAVE_component_sigev_notify_function 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sigaction component sa_sigaction overlaying sa_handler" >&5 $as_echo_n "checking for struct sigaction component sa_sigaction overlaying sa_handler... " >&6; } if ${ac_cv_comp_sa_sigaction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : eval "ac_cv_comp_sa_sigaction=nu" else # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" main() { struct sigaction x; if (&x.sa_sigaction == &x.sa_handler) { fprintf(stderr,"sa_sigaction overlays sa_handler..."); exit (1); } else { exit (0); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : eval "ac_cv_comp_sa_sigaction=yes" else eval "ac_cv_comp_sa_sigaction=no" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi if eval "test \"`echo '$ac_cv_comp_'sa_sigaction`\" = yes"; then cat >>confdefs.h <<_ACEOF #define HAVE_component_sa_sigaction 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi for ac_struct in \ addrinfo\ aiocb\ cmsghdr\ dirent\ flock\ group\ hostent\ iovec\ in_addr\ ip_opts\ linger\ msghdr\ mq_attr\ netbuf\ netent\ passwd\ pollfd\ protoent\ tm\ tms\ sched_param\ servent\ sigaction\ cma_sigaction\ sigevent\ sockaddr\ sockaddr_in\ sockaddr_un\ stat\ termios\ timespec\ timeval\ t_bind\ t_call\ t_discon\ t_info\ t_iovec\ t_kpalive\ t_linger\ t_opthdr\ t_optmgmt\ t_uderr\ t_unitdata\ itimerspec\ utimbuf\ utsname\ do { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct $ac_struct" >&5 $as_echo_n "checking for struct $ac_struct... " >&6; } if eval \${ac_cv_struct_$ac_struct+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" struct $ac_struct x; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "ac_cv_struct_$ac_struct=yes" else eval "ac_cv_struct_$ac_struct=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if eval "test \"`echo '$ac_cv_struct_'$ac_struct`\" = yes"; then cat >>confdefs.h <<_ACEOF #define HAVE_struct_$ac_struct 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } : else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi done for ac_typ in \ blkcnt_t\ blksize_t\ cc_t\ clockid_t\ clock_t\ dev_t\ fd_set\ ino_t\ in_addr_t\ in_port_t\ mqd_t\ nlink_t\ pthread_attr_t\ pthread_condattr_t\ pthread_cond_t\ pthread_key_t\ pthread_mutexattr_t\ pthread_mutex_t\ pthread_once_t\ pthread_t\ sa_family_t\ sem_t\ siginfo_t\ sigset_t\ sigval\ socklen_t \ speed_t\ suseconds_t\ tcflag_t\ timer_t\ do { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_typ" >&5 $as_echo_n "checking for $ac_typ... " >&6; } if eval \${ac_cv_type_$ac_typ+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "confsrc/pconfig.h" _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_typ[^0-9A-Za-z_]" >/dev/null 2>&1; then : eval "ac_cv_type_$ac_typ=yes" else eval "ac_cv_type_$ac_typ=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_type_'$ac_typ`\" = yes"; then cat >>confdefs.h <<_ACEOF #define HAVE_$ac_typ 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi done for ac_func in \ accept\ access\ aio_cancel\ aio_error\ aio_fsync\ aio_read\ aio_return\ aio_suspend\ aio_write\ bind\ cfgetispeed\ cfgetospeed\ cfsetispeed\ cfsetospeed\ chdir\ chmod\ chown\ clock_getres\ clock_gettime\ clock_settime\ close\ closedir\ connect\ ctermid\ ctime\ ctime_r\ dup\ dup2\ endhostent\ endnetent\ endprotoent\ endservent\ execl\ execle\ execlp\ execv\ execve\ execvp\ fchmod\ fcntl\ fdatasync\ fork\ fpathconf\ fstat\ fsync\ ftruncate\ getaddrinfo\ getcwd\ getegid\ getenv\ geteuid\ getgid\ getgrgid\ getgrgid_r\ getgrnam\ getgrnam_r\ getgroups\ gethostbyaddr\ gethostbyaddr_r\ gethostbyname\ gethostbyname_r\ gethostname\ getlogin\ getlogin_r\ getpeername\ getpgrp\ getpid\ getppid\ getnetbyaddr\ getnetbyaddr_r\ getnetbyname\ getnetbyname_r\ getprotobyname\ getprotobyname_r\ getprotobynumber\ getprotobynumber_r\ getservbyname\ getservbyname_r\ getpwnam\ getpwnam_r\ getpwuid\ getpwuid_r\ getservbyport\ getservbyport_r\ getsockname\ getsockname_r\ getsockopt\ gettimeofday\ getuid\ gmtime_r\ inet_addr\ inet_lnaof\ inet_makeaddr\ inet_network\ inet_ntoa\ inet_netof\ isatty\ isfdtype\ kill\ link\ lio_listio\ listen\ lseek\ lstat\ mkdir\ mkfifo\ mlock\ mlockall\ mmap\ mprotect\ mq_close\ mq_getattr\ mq_notify\ mq_open\ mq_receive\ mq_send\ mq_setattr\ mq_unlink\ msync\ munlock\ munlockall\ munmap\ open\ opendir\ pathconf\ pipe\ poll\ pthread_condattr_destroy\ pthread_condattr_getpshared\ pthread_condattr_init\ pthread_condattr_setpshared\ pthread_cond_broadcast\ pthread_cond_destroy\ pthread_cond_init\ pthread_cond_signal\ pthread_cond_timedwait\ pthread_cond_wait\ pthread_mutexattr_destroy\ pthread_mutexattr_getprioceiling\ pthread_mutexattr_getprotocol\ pthread_mutexattr_getpshared\ pthread_mutexattr_init\ pthread_mutexattr_setprioceiling\ pthread_mutexattr_setprotocol\ pthread_mutexattr_setpshared\ pthread_mutex_destroy\ pthread_mutex_getprioceiling\ pthread_mutex_init\ pthread_mutex_lock\ pthread_mutex_setprioceiling\ pthread_mutex_trylock\ pthread_mutex_unlock\ pthread_sigmask\ putenv\ rcvmsg\ read\ readdir\ readdir_r\ recv\ recvfrom\ recvmsg\ rename\ rand_r\ rmdir\ sched_getparam\ sched_getscheduler\ sched_get_priority_max\ sched_get_priority_min\ sched_rr_get_interval\ sched_setparam\ sched_setscheduler\ sched_yield\ select\ sem_close\ sem_destroy\ sem_getvalue\ sem_init\ sem_open\ sem_post\ sem_trywait\ sem_unlink\ sem_wait\ send\ sendto\ sendmsg\ setgid\ setenv\ sethostent\ setnetent\ setpgid\ setprotoent\ setservent\ setsid\ setsockopt\ setuid\ shm_open\ shm_unlink\ shutdown\ sigaction\ sigaddset\ sigdelset\ sigemptyset\ sigfillset\ sigismember\ siglongjmp\ sigpending\ sigprocmask\ sigqueue\ sigsetjmp\ sigsuspend\ sigtimedwait\ sigwait\ sigwaitinfo\ socket\ sockatmark\ socketpair\ stat\ strtok_r\ sysconf\ tcdrain\ tcflow\ tcflush\ tcgetattr\ tcgetpgrp\ tcsendbreak\ tcsetattr\ tcsetpgrp\ time\ timer_create\ timer_delete\ timer_getoverrun\ timer_gettime\ timer_settime\ times\ ttyname\ ttyname_r\ t_accept\ t_alloc\ t_bind\ t_blocking\ t_close\ t_connect\ t_error\ t_free\ t_getinfo\ t_getprotaddr\ t_getstate\ t_listen\ t_look\ t_nonblocking\ t_open\ t_optmgmt\ t_rcv\ t_rcvconnect\ t_rcvdis\ t_rcvrel\ t_rcvudata\ t_snd\ t_snddis\ t_sndudata\ t_strerror\ t_sync\ t_unbind\ t_rcvreldata\ t_rcvuderr\ t_rcvv\ t_rcvvudata\ t_sndreldata\ t_sndrel\ t_sndv\ t_sndvudata\ umask\ uname\ unlink\ unsetenv\ utime\ waitpid\ write\ __posix_sigwait\ __posix_ctime_r\ __posix_readdir_r\ __posix_sigwait_r\ __posix_ttyname_r\ do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define HAVE_$ac_func 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_$ac_func 0 _ACEOF fi done ac_config_files="$ac_config_files Makefile" ac_config_commands="$ac_config_commands default" test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "confsrc/config.h") CONFIG_HEADERS="$CONFIG_HEADERS confsrc/config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "default":C) test -z "$CONFIG_HEADERS" || date > stamp-h ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi florist-gpl-2017-src/gensrc.elinos/0000755000076700001450000000000013106553467016572 5ustar gnatmailgnatflorist-gpl-2017-src/gensrc.elinos/threads/0000755000076700001450000000000013106553467020224 5ustar gnatmailgnatflorist-gpl-2017-src/gensrc.elinos/threads/posix-timers-extensions.adb0000644000076700001450000000557713106553472025546 0ustar gnatmailgnatpragma Source_Reference (1, "libsrc/threads/posix-timers-extensions.gpb"); ------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . T I M E R S . E X T E N S I O N S -- -- -- -- B o d y -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ package body POSIX.Timers.Extensions is -------------------- -- Clock_SGI_Fast -- -------------------- function Clock_SGI_Fast return Clock_ID is begin --! # if HAVE_IRIX_Timers then --! return POSIX.C.CLOCK_SGI_FAST; --! # else return -1; --! # end if; end Clock_SGI_Fast; end POSIX.Timers.Extensions; florist-gpl-2017-src/gensrc.elinos/posix-limits.ads0000644000076700001450000001722113106553472021723 0ustar gnatmailgnat-- DO NOT EDIT THIS FILE. -- It is generated automatically, by program c-posix.c ------------------------------------------------------------------------------ -- -- -- POSIX Ada95 Bindings for Protocol Independent Interfaces (P1003.5c) -- -- -- -- P O S I X . L I M I T S -- -- -- -- S p e c -- -- -- -- -- -- -- -- This file is a component of FLORIST, an Ada application program -- -- interface for operating system services for use with the GNAT compiler -- -- and the Gnu Ada Runtime Library (GNARL). FLORIST is intended to -- -- conform to the IEEE POSIX Ada standards, 1003.5-1992 and 1003.5b-1993. -- -- It also includes support for Draft 1 of IEEE Project 1003.5c. -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ package POSIX.Limits is ------------------------------ -- Portable System Limits -- ------------------------------ -- .... Change P1003.5b? -- to allow these constants -- to be larger than the minimum values specified. Portable_Argument_List_Maximum : Natural renames POSIX.Portable_Argument_List_Maximum; Portable_Asynchronous_IO_Maximum : constant Natural := 1; Portable_Child_Processes_Maximum : Natural renames POSIX.Portable_Child_Processes_Maximum; Portable_Clock_Resolution_Minimum : constant := 20_000_000; Portable_Filename_Maximum : Natural renames POSIX.Portable_Filename_Limit_Maximum; Portable_Groups_Maximum : Natural renames POSIX.Portable_Groups_Maximum; Portable_Input_Line_Maximum : POSIX.IO_Count renames POSIX.Portable_Input_Line_Limit_Maximum; Portable_Input_Queue_Maximum : POSIX.IO_Count renames POSIX.Portable_Input_Queue_Limit_Maximum; Portable_Links_Maximum : Natural renames POSIX.Portable_Link_Limit_Maximum; Portable_List_IO_Maximum : constant Natural := 2; Portable_Message_Priority_Maximum : constant Natural := 32; Portable_Open_Files_Maximum : Natural renames POSIX.Portable_Open_Files_Maximum; Portable_Open_Message_Queues_Maximum : constant Natural := 8; Portable_Pathname_Maximum : Natural renames POSIX.Portable_Pathname_Limit_Maximum; Portable_Pipe_Length_Maximum : POSIX.IO_Count renames POSIX.Portable_Pipe_Limit_Maximum; Portable_Queued_Signals_Maximum : constant Natural := 32; Portable_Realtime_Signals_Maximum : constant Natural := 8; Portable_Semaphores_Maximum : constant Natural := 256; Portable_Semaphores_Value_Maximum : constant Natural := 32767; Portable_Streams_Maximum : Natural renames POSIX.Portable_Stream_Maximum; Portable_Timer_Overruns_Maximum : constant Natural := 32; Portable_Timers_Maximum : constant Natural := 32; Portable_Time_Zone_String_Maximum : Natural renames POSIX.Portable_Time_Zone_String_Maximum; -- limits from POSIX.5c [D2] Portable_File_Descriptor_Set_Maximum : Natural renames POSIX.Portable_Open_Files_Maximum; Portable_Socket_Buffer_Maximum : POSIX.IO_Count renames POSIX.Portable_Pipe_Limit_Maximum; Portable_Socket_IO_Vector_Maximum : constant Natural := 16; Portable_Socket_Connection_Maximum : constant Natural := 1; Portable_XTI_IO_Vector_Maximum : constant Natural := 16; --------------------------- -- Configurable Limits -- --------------------------- subtype Argument_List_Maxima is POSIX.Argument_List_Maxima; subtype Asynchronous_IO_Maxima is Natural range 1 .. Natural'Last; subtype Asynchronous_IO_Priority_Delta_Maxima is Natural range 20 .. 20; subtype Child_Processes_Maxima is POSIX.Child_Processes_Maxima; subtype Filename_Maxima is POSIX.Filename_Limit_Maxima; subtype Groups_Maxima is POSIX.Groups_Maxima; subtype Input_Line_Maxima is POSIX.Input_Line_Limit_Maxima; subtype Input_Queue_Maxima is POSIX.Input_Queue_Limit_Maxima; subtype Links_Maxima is POSIX.Link_Limit_Maxima; subtype List_IO_Maxima is Natural range 2 .. Natural'Last; subtype Message_Priority_Maxima is Natural range 32768 .. 32768; subtype Open_Message_Queues_Maxima is Natural range 8 .. Natural'Last; subtype Open_Files_Maxima is POSIX.Open_Files_Maxima; subtype Page_Size_Range is Natural range 4096 .. 4096; subtype Pathname_Maxima is POSIX.Pathname_Limit_Maxima; subtype Pipe_Length_Maxima is POSIX.Pipe_Limit_Maxima; subtype Queued_Signals_Maxima is Natural range 32 .. Natural'Last; subtype Realtime_Signals_Maxima is Natural range 32 .. 32; subtype Semaphores_Maxima is Natural range 256 .. Natural'Last; subtype Semaphores_Value_Maxima is Natural range 2147483647 .. 2147483647; subtype Streams_Maxima is POSIX.Stream_Maxima; subtype Timer_Overruns_Maxima is Natural range 2147483647 .. 2147483647; subtype Timers_Maxima is Natural range 32 .. Natural'Last; subtype Time_Zone_String_Maxima is POSIX.Time_Zone_String_Maxima; -- limits from POSIX.5c [D2] subtype File_Descriptor_Set_Maxima is Natural range 1024 .. 1024; subtype Socket_Buffer_Maxima is IO_Count range 512 .. IO_Count'Last; subtype Socket_IO_Vector_Maxima is Natural range 1024 .. 1024; subtype Socket_Connection_Maxima is Natural range 1 .. Natural'Last; subtype XTI_IO_Vector_Maxima is Natural range 16 .. Natural'Last; end POSIX.Limits; florist-gpl-2017-src/gensrc.elinos/posix.ads0000644000076700001450000006117513106553472020433 0ustar gnatmailgnat-- DO NOT EDIT THIS FILE. -- It is generated automatically, by program c-posix.c ------------------------------------------------------------------------------ -- -- -- POSIX Ada95 Bindings for Protocol Independent Interfaces (P1003.5c) -- -- -- -- P O S I X -- -- -- -- S p e c -- -- -- -- -- -- -- -- This file is a component of FLORIST, an Ada application program -- -- interface for operating system services for use with the GNAT compiler -- -- and the Gnu Ada Runtime Library (GNARL). FLORIST is intended to -- -- conform to the IEEE POSIX Ada standards, 1003.5-1992 and 1003.5b-1993. -- -- It also includes support for Draft 1 of IEEE Project 1003.5c. -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with Ada.Streams; with Interfaces; package POSIX is -- 2.4.1 Constants and Static Subtypes -- Version Identification POSIX_Version : constant := 200112; POSIX_Ada_Version : constant := 1995_00; -- Optional Facilities (obsolescent, 0) -- See package POSIX.Limits for preferred interfaces. subtype Job_Control_Support is Boolean range True .. True; subtype Saved_IDs_Support is Boolean range True .. True; subtype Change_Owner_Restriction is Boolean range True .. True; subtype Filename_Truncation is Boolean range True .. True; -- Bytes and I/O Counts Byte_Size : constant := 8; type IO_Count is range -2**31 .. (2**31) - 1; for IO_Count'Size use 32; subtype IO_Count_Maxima is IO_Count range 32767 .. IO_Count'Last; -- System Limits (obsolescent) -- See package POSIX.Limits for preferred interfaces. Portable_Groups_Maximum : constant Natural := 8; subtype Groups_Maxima is Natural range 65536 .. Natural'Last; Portable_Argument_List_Maximum : constant Natural := 4096; subtype Argument_List_Maxima is Natural range 4096 .. Natural'Last; Portable_Child_Processes_Maximum : constant Natural := 25; subtype Child_Processes_Maxima is Natural range 25 .. Natural'Last; Portable_Open_Files_Maximum : constant Natural := 20; subtype Open_Files_Maxima is Natural range 20 .. Natural'Last; Portable_Stream_Maximum : constant Natural := 8; subtype Stream_Maxima is Natural range 8 .. Natural'Last; Portable_Time_Zone_String_Maximum : constant Natural := 6; subtype Time_Zone_String_Maxima is Natural range 6 .. Natural'Last; -- Pathname Variable Values (obsolescent) -- See package POSIX.Limits for preferred interfaces. Portable_Link_Limit_Maximum : constant Natural := 8; subtype Link_Limit_Maxima is Natural range 8 .. Natural'Last; Portable_Input_Line_Limit_Maximum : constant IO_Count := 255; subtype Input_Line_Limit_Maxima is IO_Count range 255 .. 255; Portable_Input_Queue_Limit_Maximum : constant IO_Count := 255; subtype Input_Queue_Limit_Maxima is IO_Count range 255 .. 255; Portable_Filename_Limit_Maximum : constant Natural := 14; subtype Filename_Limit_Maxima is Natural range 255 .. 255; Portable_Pathname_Limit_Maximum : constant Natural := 256; subtype Pathname_Limit_Maxima is Natural range 4096 .. 4096; Portable_Pipe_Limit_Maximum : constant IO_Count := 512; subtype Pipe_Limit_Maxima is IO_Count range 4096 .. 4096; -- Blocking Behavior Values type Blocking_Behavior is (Tasks, Program, Special); subtype Text_IO_Blocking_Behavior is Blocking_Behavior range Tasks .. Tasks; IO_Blocking_Behavior : constant Blocking_Behavior := Tasks; File_Lock_Blocking_Behavior : constant Blocking_Behavior := Tasks; Wait_For_Child_Blocking_Behavior : constant Blocking_Behavior := Tasks; subtype Realtime_Blocking_Behavior is Blocking_Behavior range Tasks .. Program; -- Signal Masking type Signal_Masking is (No_Signals, RTS_Signals, All_Signals); -- Characters and Strings type POSIX_Character is new Standard.Character; -- We rely here on the fact that the GNAT type Character -- is the same as the GCC type char in C, -- which in turn must be the same as POSIX_Character. NUL : constant POSIX_Character := POSIX_Character (ASCII.NUL); SOH : constant POSIX_Character := POSIX_Character (ASCII.SOH); STX : constant POSIX_Character := POSIX_Character (ASCII.STX); ETX : constant POSIX_Character := POSIX_Character (ASCII.ETX); EOT : constant POSIX_Character := POSIX_Character (ASCII.EOT); ENQ : constant POSIX_Character := POSIX_Character (ASCII.ENQ); ACK : constant POSIX_Character := POSIX_Character (ASCII.ACK); BEL : constant POSIX_Character := POSIX_Character (ASCII.BEL); BS : constant POSIX_Character := POSIX_Character (ASCII.BS); HT : constant POSIX_Character := POSIX_Character (ASCII.HT); LF : constant POSIX_Character := POSIX_Character (ASCII.LF); VT : constant POSIX_Character := POSIX_Character (ASCII.VT); FF : constant POSIX_Character := POSIX_Character (ASCII.FF); CR : constant POSIX_Character := POSIX_Character (ASCII.CR); SO : constant POSIX_Character := POSIX_Character (ASCII.SO); SI : constant POSIX_Character := POSIX_Character (ASCII.SI); DLE : constant POSIX_Character := POSIX_Character (ASCII.DLE); DC1 : constant POSIX_Character := POSIX_Character (ASCII.DC1); DC2 : constant POSIX_Character := POSIX_Character (ASCII.DC2); DC3 : constant POSIX_Character := POSIX_Character (ASCII.DC3); DC4 : constant POSIX_Character := POSIX_Character (ASCII.DC4); NAK : constant POSIX_Character := POSIX_Character (ASCII.NAK); SYN : constant POSIX_Character := POSIX_Character (ASCII.SYN); ETB : constant POSIX_Character := POSIX_Character (ASCII.ETB); CAN : constant POSIX_Character := POSIX_Character (ASCII.CAN); EM : constant POSIX_Character := POSIX_Character (ASCII.EM); SUB : constant POSIX_Character := POSIX_Character (ASCII.SUB); ESC : constant POSIX_Character := POSIX_Character (ASCII.ESC); FS : constant POSIX_Character := POSIX_Character (ASCII.FS); GS : constant POSIX_Character := POSIX_Character (ASCII.GS); RS : constant POSIX_Character := POSIX_Character (ASCII.RS); US : constant POSIX_Character := POSIX_Character (ASCII.US); type POSIX_String is array (Positive range <>) of aliased POSIX_Character; function To_POSIX_String (Str : String) return POSIX_String; function To_POSIX_String (Str : Wide_String) return POSIX_String; function To_String (Str : POSIX_String) return String; function To_Wide_String (Str : POSIX_String) return Wide_String; function To_Stream_Element_Array (Buffer : POSIX_String) return Ada.Streams.Stream_Element_Array; function To_POSIX_String (Buffer : Ada.Streams.Stream_Element_Array) return POSIX_String; subtype Filename is POSIX_String; subtype Pathname is POSIX_String; function Is_Filename (Str : POSIX_String) return Boolean; function Is_Pathname (Str : POSIX_String) return Boolean; function Is_Portable_Filename (Str : POSIX_String) return Boolean; function Is_Portable_Pathname (Str : POSIX_String) return Boolean; -- String Lists type POSIX_String_List is limited private; Empty_String_List : constant POSIX_String_List; procedure Make_Empty (List : in out POSIX_String_List); procedure Append (List : in out POSIX_String_List; Str : POSIX_String); generic with procedure Action (Item : POSIX_String; Quit : in out Boolean); procedure For_Every_Item (List : POSIX_String_List); function Length (List : POSIX_String_List) return Natural; function Value (List : POSIX_String_List; Index : Positive) return POSIX_String; -- option sets type Option_Set is private; function Empty_Set return Option_Set; function "+" (L, R : Option_Set) return Option_Set; function "-" (L, R : Option_Set) return Option_Set; function "<" (Left, Right : Option_Set) return Boolean; function "<="(Left, Right : Option_Set) return Boolean; function ">" (Left, Right : Option_Set) return Boolean; function ">="(Left, Right : Option_Set) return Boolean; Option_1 : constant Option_Set; Option_2 : constant Option_Set; Option_3 : constant Option_Set; Option_4 : constant Option_Set; Option_5 : constant Option_Set; Option_6 : constant Option_Set; Option_7 : constant Option_Set; Option_8 : constant Option_Set; Option_9 : constant Option_Set; Option_10 : constant Option_Set; Option_11 : constant Option_Set; Option_12 : constant Option_Set; Option_13 : constant Option_Set; Option_14 : constant Option_Set; Option_15 : constant Option_Set; Option_16 : constant Option_Set; Option_17 : constant Option_Set; Option_18 : constant Option_Set; Option_19 : constant Option_Set; Option_20 : constant Option_Set; Option_21 : constant Option_Set; Option_22 : constant Option_Set; Option_23 : constant Option_Set; Option_24 : constant Option_Set; Option_25 : constant Option_Set; Option_26 : constant Option_Set; Option_27 : constant Option_Set; Option_28 : constant Option_Set; Option_29 : constant Option_Set; Option_30 : constant Option_Set; Option_31 : constant Option_Set; -- Exceptions and error codes POSIX_Error : exception; type Error_Code is range -2**31 .. (2**31) - 1; for Error_Code'Size use 32; function Get_Error_Code return Error_Code; procedure Set_Error_Code (Error : Error_Code); function Is_POSIX_Error (Error : Error_Code) return Boolean; function Image (Error : Error_Code) return String; No_Error : constant Error_Code := 0; -- Error code constants with negative values correspond to -- error codes that are not supported by the current system. -- error codes E2BIG, Argument_List_Too_Long : constant := 7; EACCES, Permission_Denied : constant := 13; EADDRINUSE, Address_In_Use : constant := 98; EADDRNOTAVAIL, Address_Not_Available : constant := 99; EAFNOSUPPORT, Inappropriate_Family : constant := 97; EAGAIN, Resource_Temporarily_Unavailable : constant := 11; EALREADY, Already_Awaiting_Connection : constant := 114; EBADF, Bad_File_Descriptor : constant := 9; EBADMSG, Bad_Message : constant := 74; EBUSY, Resource_Busy : constant := 16; ECANCELED, Operation_Canceled : constant := 125; ECHILD, No_Child_Process : constant := 10; ECONNABORTED, Connection_Aborted : constant := 103; ECONNREFUSED, Connection_Refused : constant := 111; ECONNRESET, Connection_Reset : constant := 104; EDEADLK, Resource_Deadlock_Avoided : constant := 35; EDOM, Domain_Error : constant := 33; EEXIST, File_Exists : constant := 17; EFAULT, Bad_Address : constant := 14; EFBIG, File_Too_Large : constant := 27; EHOSTDOWN, Host_Down : constant := 112; EHOSTUNREACH, Host_Unreachable : constant := 113; EINPROGRESS, Operation_In_Progress : constant := 115; EINTR, Interrupted_Operation : constant := 4; EINVAL, Invalid_Argument : constant := 22; EIO, Input_Output_Error : constant := 5; EISCONN, Is_Already_Connected : constant := 106; EISDIR, Is_A_Directory : constant := 21; EMFILE, Too_Many_Open_Files : constant := 24; EMLINK, Too_Many_Links : constant := 31; EMSGSIZE, Message_Too_Long : constant := 90; ENAMETOOLONG, Filename_Too_Long : constant := 36; ENETDOWN, Network_Down : constant := 100; ENETRESET, Network_Reset : constant := 102; ENETUNREACH, Network_Unreachable : constant := 101; ENFILE, Too_Many_Open_Files_In_System : constant := 23; ENOBUFS, No_Buffer_Space : constant := 105; ENODEV, No_Such_Operation_On_Device : constant := 19; ENOENT, No_Such_File_Or_Directory : constant := 2; ENOPROTOOPT, Unknown_Protocol_Option : constant := 92; ENOEXEC, Exec_Format_Error : constant := 8; ENOLCK, No_Locks_Available : constant := 37; ENOMEM, Not_Enough_Space : constant := 12; ENOSPC, No_Space_Left_On_Device : constant := 28; ENOTCONN, Not_Connected : constant := 107; ENOTSOCK, Not_A_Socket : constant := 88; ENOTSUP, Operation_Not_Supported : constant := 95; ENOTDIR, Not_A_Directory : constant := 20; ENOTEMPTY, Directory_Not_Empty : constant := 39; ENOSYS, Operation_Not_Implemented : constant := 38; ENOTTY, Inappropriate_IO_Control_Operation : constant := 25; ENXIO, No_Such_Device_Or_Address : constant := 6; EOPNOTSUPP, Option_Not_Supported : constant := 95; EPERM, Operation_Not_Permitted : constant := 1; EPIPE, Broken_Pipe : constant := 32; EPROTONOSUPPORT, Protocol_Not_Supported : constant := 93; EPROTOTYPE, Wrong_Protocol_Type : constant := 91; ERANGE, TBD2 : constant := 34; EROFS, Read_Only_File_System : constant := 30; ESOCKTNOSUPPORT, Socket_Not_Supported : constant := 94; ESPIPE, Invalid_Seek : constant := 29; ESRCH, No_Such_Process : constant := 3; ETIMEDOUT, Timed_Out : constant := 110; EWOULDBLOCK, Would_Block : constant := 11; EXDEV, Improper_Link : constant := 18; Host_Not_Found : constant := 1; NO_DATA, No_Address_Available : constant := 4; NO_RECOVERY, Unrecoverable_Error : constant := 3; -- *** MISSING: EAI_ADDRFAMILY *** -- EAI_ADDRFAMILY, Unknown_Address_Type : constant := -1; EAI_AGAIN, Try_Again : constant := 9997; EAI_BADFLAGS, Invalid_Flags : constant := 9999; EAI_FAIL, Name_Failed : constant := 9996; EAI_FAMILY, Unknown_Protocol_Family : constant := 9994; EAI_MEMORY, Memory_Allocation_Failed : constant := 9990; -- *** MISSING: EAI_NODATA *** -- EAI_NODATA, No_Address_For_Name : constant := -1; EAI_NONAME, Name_Not_Known : constant := 9998; EAI_SERVICE, Service_Not_Supported : constant := 9992; EAI_SOCKTYPE, Unknown_Socket_Type : constant := 9993; subtype Addrinfo_Error_Code is Error_Code range 10000 .. 10000; -- *** MISSING: TACCES *** -- TACCES, Insufficient_Permission : constant := -1; -- *** MISSING: TADDRBUSY *** -- TADDRBUSY, XTI_Address_In_Use : constant := -1; -- *** MISSING: TBADADDR *** -- TBADADDR, Incorrect_Address_Format : constant := -1; -- *** MISSING: TBADDATA *** -- TBADDATA, Illegal_Data_Range : constant := -1; -- *** MISSING: TBADF *** -- TBADF, Invalid_File_Descriptor : constant := -1; -- *** MISSING: TBADFLAG *** -- TBADFLAG, Invalid_Flag : constant := -1; -- *** MISSING: TBADNAME *** -- TBADNAME, Invalid_Communications_Provider : constant := -1; -- *** MISSING: TBADOPT *** -- TBADOPT, Incorrect_Or_Illegal_Option : constant := -1; -- *** MISSING: TBADQLEN *** -- TBADQLEN, Endpoint_Queue_Length_Is_Zero : constant := -1; -- *** MISSING: TBADSEQ *** -- TBADSEQ, Invalid_Sequence_Number : constant := -1; -- *** MISSING: TBUFOVFLW *** -- TBUFOVFLW, Buffer_Not_Large_Enough : constant := -1; -- *** MISSING: TFLOW *** -- TFLOW, Flow_Control_Error : constant := -1; -- *** MISSING: TINDOUT *** -- TINDOUT, Outstanding_Connection_Indications : constant := -1; -- *** MISSING: TLOOK *** -- TLOOK, Event_Requires_Attention : constant := -1; -- *** MISSING: TNOADDR *** -- TNOADDR, Could_Not_Allocate_Address : constant := -1; -- *** MISSING: TNODATA *** -- TNODATA, No_Data_Available : constant := -1; -- *** MISSING: TNODIS *** -- TNODIS, No_Disconnect_Indication_On_Endpoint : constant := -1; -- *** MISSING: TPROVMISMATCH *** -- TPROVMISMATCH, Communications_Provider_Mismatch : constant := -1; -- *** MISSING: TNOREL *** -- TNOREL, No_Orderly_Release_Indication_On_Endpoint : constant := -1; -- *** MISSING: TNOSTRUCTYPE *** -- TNOSTRUCTYPE, Unsupported_Object_Type_Requested : constant := -1; -- *** MISSING: TNOTSUPPORT *** -- TNOTSUPPORT, Function_Not_Supported : constant := -1; -- *** MISSING: TNOUDERR *** -- TNOUDERR, No_Unitdata_Error_On_Endpoint : constant := -1; -- *** MISSING: TOUTSTATE *** -- TOUTSTATE, Function_Not_Valid_For_State : constant := -1; -- *** MISSING: TPROTO *** -- TPROTO, Protocol_Error : constant := -1; -- *** MISSING: TQFULL *** -- TQFULL, Endpoint_Queue_Full : constant := -1; -- *** MISSING: TSTATECHNG *** -- TSTATECHNG, State_Change_In_Progress : constant := -1; -- *** MISSING: TRESADDR *** -- TRESADDR, Surrogate_File_Descriptor_Mismatch : constant := -1; -- *** MISSING: TRESQLEN *** -- TRESQLEN, Incorrect_Surrogate_Queue_Length : constant := -1; subtype XTI_Error_Code is Error_Code range 100000 .. 100000; -- System Identification function System_Name return POSIX_String; function Node_Name return POSIX_String; function Release return POSIX_String; function Version return POSIX_String; function Machine return POSIX_String; type Seconds is new Integer; type Minutes is new Integer; type Nanoseconds_Base is new Integer; subtype Nanoseconds is Nanoseconds_Base range 0 .. (10**9) - 1; type Timespec is private; function Get_Seconds (Time : Timespec) return Seconds; procedure Set_Seconds (Time : in out Timespec; S : Seconds); function Get_Nanoseconds (Time : Timespec) return Nanoseconds; procedure Set_Nanoseconds (Time : in out Timespec; NS : Nanoseconds); procedure Split (Time : Timespec; S : out Seconds; NS : out Nanoseconds); function To_Timespec (S : Seconds; NS : Nanoseconds) return Timespec; function "+" (Left, Right : Timespec) return Timespec; function "+" (Left : Timespec; Right : Nanoseconds) return Timespec; function "-" (Right : Timespec) return Timespec; function "-" (Left, Right : Timespec) return Timespec; function "-" (Left : Timespec; Right : Nanoseconds) return Timespec; function "*" (Left : Timespec; Right : Integer) return Timespec; function "*" (Left : Integer; Right : Timespec) return Timespec; function "/" (Left : Timespec; Right : Integer) return Timespec; function "/" (Left, Right : Timespec) return Integer; function "<" (Left, Right : Timespec) return Boolean; function "<=" (Left, Right : Timespec) return Boolean; function ">" (Left, Right : Timespec) return Boolean; function ">=" (Left, Right : Timespec) return Boolean; function To_Duration (Time : Timespec) return Duration; -- pragma Inline (To_Duration); function To_Timespec (D : Duration) return Timespec; -- pragma Inline (To_Timespec); ------------------------------------------- -- Host-Network Byte Order Conversions -- ------------------------------------------- Host_Byte_Order_Is_Net_Byte_Order : Boolean := True; function Host_To_Network_Byte_Order (Host_32 : Interfaces.Unsigned_32) return Interfaces.Unsigned_32; function Host_To_Network_Byte_Order (Host_16 : Interfaces.Unsigned_16) return Interfaces.Unsigned_16; function Network_To_Host_Byte_Order (Host_32 : Interfaces.Unsigned_32) return Interfaces.Unsigned_32; function Network_To_Host_Byte_Order (Host_16 : Interfaces.Unsigned_16) return Interfaces.Unsigned_16; XTI_Blocking_Behavior : constant Blocking_Behavior := Tasks; Sockets_Blocking_Behavior : constant Blocking_Behavior := Tasks; -------------------------- -- Octet declarations -- -------------------------- type Octet is mod 2 ** 8; type Octet_Array is array (Integer range <>) of aliased Octet; type Octet_Array_Pointer is access all Octet_Array; private Florist_Version : constant String := "7.3.0w"; type String_List; -- See package body for comments on String_List. type POSIX_String_List is access all String_List; pragma No_Strict_Aliasing (POSIX_String_List); Empty_String_List : constant POSIX_String_List := null; type Timespec is record Val : Duration := 0.0; end record; -- The value is of type Duration because we can do more -- efficient arithmetic on that type than on a two-part C struct. -- We rely that GNAT implements type Duration with enough -- precision (64 bits) to hold a full C timespec value. -- The enclosing record is to permit implicit initialization. type Bits is mod 2**32; for Bits'Size use 32; -- Bits and the C int type are always the same size. -- We don't define int here, since we want to be able to -- use it in the visible parts of child packages. type Option_Set is record Option : Bits := 0; end record; Option_1 : constant Option_Set := (Option => 2**0); Option_2 : constant Option_Set := (Option => 2**1); Option_3 : constant Option_Set := (Option => 2**2); Option_4 : constant Option_Set := (Option => 2**3); Option_5 : constant Option_Set := (Option => 2**4); Option_6 : constant Option_Set := (Option => 2**5); Option_7 : constant Option_Set := (Option => 2**6); Option_8 : constant Option_Set := (Option => 2**7); Option_9 : constant Option_Set := (Option => 2**8); Option_10 : constant Option_Set := (Option => 2**9); Option_11 : constant Option_Set := (Option => 2**10); Option_12 : constant Option_Set := (Option => 2**11); Option_13 : constant Option_Set := (Option => 2**12); Option_14 : constant Option_Set := (Option => 2**13); Option_15 : constant Option_Set := (Option => 2**14); Option_16 : constant Option_Set := (Option => 2**15); Option_17 : constant Option_Set := (Option => 2**16); Option_18 : constant Option_Set := (Option => 2**17); Option_19 : constant Option_Set := (Option => 2**18); Option_20 : constant Option_Set := (Option => 2**19); Option_21 : constant Option_Set := (Option => 2**20); Option_22 : constant Option_Set := (Option => 2**21); Option_23 : constant Option_Set := (Option => 2**22); Option_24 : constant Option_Set := (Option => 2**23); Option_25 : constant Option_Set := (Option => 2**24); Option_26 : constant Option_Set := (Option => 2**25); Option_27 : constant Option_Set := (Option => 2**26); Option_28 : constant Option_Set := (Option => 2**27); Option_29 : constant Option_Set := (Option => 2**28); Option_30 : constant Option_Set := (Option => 2**29); Option_31 : constant Option_Set := (Option => 2**30); end POSIX; florist-gpl-2017-src/gensrc.elinos/posix-c.ads0000644000076700001450000031601713106553472020651 0ustar gnatmailgnat-- DO NOT EDIT THIS FILE. -- It is generated automatically, by program c-posix.c ------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . C -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996, 1997 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an Ada application program -- -- interface for operating system services for use with the GNAT compiler -- -- and the Gnu Ada Runtime Library (GNARL). FLORIST is intended to -- -- conform to the IEEE POSIX Ada standards, 1003.5-1992 and 1003.5b-1993. -- -- It also includes support for Draft 1 of IEEE Project 1003.5c. -- -- -- -- This is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. This software is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with System; use System; with Unchecked_Conversion; package POSIX.C is pragma Elaborate_Body; -- ========= -- -- WARNING -- -- ========= -- -- This package should NOT be used directly by an application. -- It is internal to the FLORIST implementation of the POSIX.5 API, -- and may be changed or replaced in future versions of FLORIST. ALIGNMENT : constant := Natural'Min (Standard'Maximum_Alignment, 8); -- worst-case alignment requirement --------------------- -- basic C types -- --------------------- type short is range -2**15 .. (2**15) - 1; for short'Size use 16; type int is range -2**31 .. (2**31) - 1; for int'Size use 32; type int_ptr is access constant int; pragma Convention (C, int_ptr); type int_var_ptr is access all int; pragma Convention (C, int_var_ptr); type unsigned is mod 2**32; for unsigned'Size use 32; type long is range -2**31 .. (2**31) - 1; for long'Size use 32; type unsigned_long is mod 2**32; for unsigned_long'Size use 32; type unsigned_int is mod 2**32; for unsigned_int'Size use 32; type unsigned_short is mod 2**16; for unsigned_short'Size use 16; type caddr_t is mod 2**32; for caddr_t'Size use 32; type size_t is range -2**31 .. (2**31) - 1; for size_t'Size use 32; type size_t_ptr is access constant size_t; pragma Convention (C, size_t_ptr); type size_t_var_ptr is access all size_t; pragma Convention (C, size_t_var_ptr); type time_t is range -2**31 .. (2**31) - 1; for time_t'Size use 32; type time_t_ptr is access constant time_t; pragma Convention (C, time_t_ptr); type time_t_var_ptr is access all time_t; pragma Convention (C, time_t_var_ptr); type clock_t is mod 2**32; for clock_t'Size use 32; type clock_t_ptr is access constant clock_t; pragma Convention (C, clock_t_ptr); type clock_t_var_ptr is access all clock_t; pragma Convention (C, clock_t_var_ptr); type ptr_as_int is range -2**31 .. (2**31) - 1; for ptr_as_int'Size use 32; subtype char is POSIX_Character; type char_ptr is access constant char; pragma Convention (C, char_ptr); type char_var_ptr is access all char; pragma Convention (C, char_var_ptr); function To_Ptr is new Unchecked_Conversion (Address, char_ptr); function To_char_ptr (Addr : Address) return char_ptr renames To_Ptr; function To_Address is new Unchecked_Conversion (char_ptr, Address); type char_ptr_ptr is access constant char_ptr; pragma Convention (C, char_ptr_ptr); type char_ptr_var_ptr is access all char_ptr; pragma Convention (C, char_ptr_var_ptr); function To_Ptr is new Unchecked_Conversion (Address, char_ptr_ptr); function To_Address is new Unchecked_Conversion (char_ptr_ptr, Address); type char_ptr_array is array (Positive range <>) of aliased char_ptr; function malloc (size : size_t) return char_ptr; function malloc (size : size_t) return char_ptr_ptr; pragma Import (C, malloc, "malloc"); procedure free (object : char_ptr); procedure free (object : char_ptr_ptr); pragma Import (C, free, "free"); procedure Advance (Ptr : in out char_ptr); procedure Advance (Ptr : in out char_ptr_ptr); -- advance Ptr to next location -- pragma Inline (Advance); function Form_POSIX_String (Str : char_ptr) return POSIX_String; -- makes new copy of string, without null terminator ----------------- -- constants -- ----------------- AIO_ALLDONE : constant := 2; AIO_CANCELED : constant := 0; AIO_NOTCANCELED : constant := 1; B0 : constant := 0; B110 : constant := 3; B115200 : constant := 17; B1200 : constant := 9; B134 : constant := 4; B150 : constant := 5; B1800 : constant := 10; B19200 : constant := 14; B200 : constant := 6; B230400 : constant := 18; B2400 : constant := 11; B300 : constant := 7; B38400 : constant := 15; B460800 : constant := 19; B4800 : constant := 12; B50 : constant := 1; B57600 : constant := 16; B600 : constant := 8; B75 : constant := 2; B9600 : constant := 13; BRKINT : constant := 2; -- *** MISSING: CLK_TCK *** -- CLK_TCK : constant := 0; CLOCAL : constant := 32768; CLOCK_REALTIME : constant := 0; CREAD : constant := 2048; CSIZE : constant := 768; CSTOPB : constant := 1024; CS5 : constant := 0; CS6 : constant := 256; CS7 : constant := 512; CS8 : constant := 768; -- error code constants are in posix.ads ECHO : constant := 8; ECHOE : constant := 2; ECHOK : constant := 4; ECHONL : constant := 16; FD_CLOEXEC : constant := 1; F_DUPFD : constant := 0; F_GETFD : constant := 1; F_GETFL : constant := 3; F_GETLK : constant := 12; F_OK : constant := 0; F_RDLCK : constant := 0; F_SETFD : constant := 2; F_SETFL : constant := 4; F_SETLK : constant := 13; F_SETLKW : constant := 14; F_UNLCK : constant := 2; F_WRLCK : constant := 1; HUPCL : constant := 16384; ICANON : constant := 256; ICRNL : constant := 256; IEXTEN : constant := 1024; IGNBRK : constant := 1; IGNCR : constant := 128; IGNPAR : constant := 4; INLCR : constant := 64; INPCK : constant := 16; ISIG : constant := 128; ISTRIP : constant := 32; IXOFF : constant := 1024; IXON : constant := 512; L_ctermid : constant := 9; LIO_NOP : constant := 2; LIO_NOWAIT : constant := 1; LIO_READ : constant := 0; LIO_WAIT : constant := 0; LIO_WRITE : constant := 1; MAP_FAILED : constant := -1; MAP_FILE : constant := 0; MAP_FIXED : constant := 16; -- *** MISSING: MAP_VARIABLE *** -- MAP_VARIABLE : constant := 0; MAP_PRIVATE : constant := 2; MAP_SHARED : constant := 1; MAX_CANON : constant := 255; MAX_INPUT : constant := 255; MCL_CURRENT : constant := 8192; MCL_FUTURE : constant := 16384; MS_ASYNC : constant := 1; MS_INVALIDATE : constant := 2; MS_SYNC : constant := 4; -- *** MISSING: MS_EINTR *** -- MS_EINTR : constant := 0; NCCS : constant := 32; NOFLSH : constant := 2147483648; OPOST : constant := 1; O_ACCMODE : constant := 3; O_APPEND : constant := 1024; O_CREAT : constant := 64; O_DSYNC : constant := 4096; O_EXCL : constant := 128; O_NOCTTY : constant := 256; O_NONBLOCK : constant := 2048; O_RDONLY : constant := 0; O_RDWR : constant := 2; O_RSYNC : constant := 4096; O_SYNC : constant := 4096; O_TRUNC : constant := 512; O_WRONLY : constant := 1; -- *** MISSING: PAGESIZE *** -- PAGESIZE : constant := 0; PARENB : constant := 4096; PARMRK : constant := 8; PARODD : constant := 8192; PROT_EXEC : constant := 4; PROT_NONE : constant := 0; PROT_READ : constant := 1; PROT_WRITE : constant := 2; PTHREAD_DESTRUCTOR_ITERATIONS : constant := 4; PTHREAD_EXPLICIT_SCHED : constant := 1; PTHREAD_INHERIT_SCHED : constant := 0; -- *** MISSING: PTHREAD_PRIO_INHERIT *** -- PTHREAD_PRIO_INHERIT : constant := 0; -- *** MISSING: PTHREAD_PRIO_NONE *** -- PTHREAD_PRIO_NONE : constant := 0; -- *** MISSING: PTHREAD_PRIO_PROTECT *** -- PTHREAD_PRIO_PROTECT : constant := 0; PTHREAD_PROCESS_SHARED : constant := 1; PTHREAD_PROCESS_PRIVATE : constant := 0; PTHREAD_SCOPE_PROCESS : constant := 1; PTHREAD_SCOPE_SYSTEM : constant := 0; R_OK : constant := 4; SA_NOCLDSTOP : constant := 1; SA_SIGINFO : constant := 4; SCHED_FIFO : constant := 1; SCHED_OTHER : constant := 0; SCHED_RR : constant := 2; SEEK_CUR : constant := 1; SEEK_END : constant := 2; SEEK_SET : constant := 0; SIGABRT : constant := 6; SIGALRM : constant := 14; SIGBUS : constant := 7; SIGCHLD : constant := 17; SIGCONT : constant := 18; SIGEV_NONE : constant := 1; SIGEV_SIGNAL : constant := 0; SIGEV_THREAD : constant := 2; SIGFPE : constant := 8; SIGHUP : constant := 1; SIGILL : constant := 4; SIGINT : constant := 2; SIGIO : constant := 29; SIGKILL : constant := 9; SIGPIPE : constant := 13; SIGQUIT : constant := 3; SIGRTMAX : constant := 64; SIGRTMIN : constant := 34; NSIGS : constant := 64; SIGSEGV : constant := 11; SIGSTOP : constant := 19; SIGTERM : constant := 15; SIGTRAP : constant := 5; SIGTSTP : constant := 20; SIGTTIN : constant := 21; SIGTTOU : constant := 22; SIGURG : constant := 23; SIGUSR1 : constant := 10; SIGUSR2 : constant := 12; SIG_BLOCK : constant := 0; SIG_DFL : constant := 0; SIG_IGN : constant := 1; SIG_SETMASK : constant := 2; SIG_UNBLOCK : constant := 1; SI_ASYNCIO : constant := -4; SI_MESGQ : constant := -3; SI_QUEUE : constant := -1; SI_TIMER : constant := -2; SI_USER : constant := 0; S_IFSOCK : constant := 49152; S_IRGRP : constant := 32; S_IROTH : constant := 4; S_IRUSR : constant := 256; S_IRWXG : constant := 56; S_IRWXO : constant := 7; S_IRWXU : constant := 448; S_ISGID : constant := 1024; S_ISUID : constant := 2048; S_IWGRP : constant := 16; S_IWOTH : constant := 2; S_IWUSR : constant := 128; S_IXGRP : constant := 8; S_IXOTH : constant := 1; S_IXUSR : constant := 64; TCIFLUSH : constant := 0; TCIOFF : constant := 2; TCIOFLUSH : constant := 2; TCION : constant := 3; TCOFLUSH : constant := 1; TCOOFF : constant := 0; TCOON : constant := 1; TCSADRAIN : constant := 1; TCSAFLUSH : constant := 2; TCSANOW : constant := 0; TIMER_ABSTIME : constant := 1; -- *** MISSING: TIMER_RELTIME *** -- TIMER_RELTIME : constant := 0; TOSTOP : constant := 4194304; VEOF : constant := 4; VEOL : constant := 6; VERASE : constant := 2; VINTR : constant := 0; VKILL : constant := 3; VMIN : constant := 5; VQUIT : constant := 1; VSTART : constant := 13; VSTOP : constant := 14; VSUSP : constant := 12; VTIME : constant := 7; WNOHANG : constant := 1; WUNTRACED : constant := 2; W_OK : constant := 2; X_OK : constant := 1; PC_ASYNC_IO : constant := 10; PC_CHOWN_RESTRICTED : constant := 6; PC_LINK_MAX : constant := 0; PC_MAX_CANON : constant := 1; PC_MAX_INPUT : constant := 2; PC_NAME_MAX : constant := 3; PC_NO_TRUNC : constant := 7; PC_PATH_MAX : constant := 4; PC_PIPE_BUF : constant := 5; PC_PRIO_IO : constant := 11; PC_SYNC_IO : constant := 9; PC_SOCK_MAXBUF : constant := 12; SC_AIO_LISTIO_MAX : constant := 23; SC_AIO_MAX : constant := 24; SC_AIO_PRIO_DELTA_MAX : constant := 25; SC_ARG_MAX : constant := 0; SC_ASYNCHRONOUS_IO : constant := 12; SC_CHILD_MAX : constant := 1; SC_CLK_TCK : constant := 2; SC_DELAYTIMER_MAX : constant := 26; SC_FSYNC : constant := 15; SC_JOB_CONTROL : constant := 7; SC_MAPPED_FILES : constant := 16; SC_MEMLOCK : constant := 17; SC_MEMLOCK_RANGE : constant := 18; SC_MEMORY_PROTECTION : constant := 19; SC_MESSAGE_PASSING : constant := 20; SC_MQ_OPEN_MAX : constant := 27; SC_MQ_PRIO_MAX : constant := 28; SC_NGROUPS_MAX : constant := 3; SC_OPEN_MAX : constant := 4; SC_PAGESIZE : constant := 30; SC_PII : constant := 53; SC_PII_XTI : constant := 54; SC_PII_SOCKET : constant := 55; SC_PII_INTERNET : constant := 56; SC_PII_INTERNET_STREAM : constant := 61; SC_PII_INTERNET_DGRAM : constant := 62; SC_PII_OSI : constant := 57; SC_PII_OSI_M : constant := 65; SC_PII_OSI_COTS : constant := 63; SC_PII_OSI_CLTS : constant := 64; -- *** MISSING: SC_PII_NET_SUPPORT *** -- SC_PII_NET_SUPPORT : constant := 0; SC_POLL : constant := 58; -- *** MISSING: SC_POSIX_PII_NET_SUPPORT *** -- SC_POSIX_PII_NET_SUPPORT : constant := 0; SC_PRIORITIZED_IO : constant := 13; SC_PRIORITY_SCHEDULING : constant := 10; SC_SELECT : constant := 59; SC_THREAD_PROCESS_SHARED : constant := 82; SC_REALTIME_SIGNALS : constant := 9; SC_RTSIG_MAX : constant := 31; SC_SAVED_IDS : constant := 8; SC_SEMAPHORES : constant := 21; SC_SEM_NSEMS_MAX : constant := 32; SC_SEM_VALUE_MAX : constant := 33; SC_SHARED_MEMORY_OBJECTS : constant := 22; SC_SIGQUEUE_MAX : constant := 34; SC_STREAM_MAX : constant := 5; SC_SYNCHRONIZED_IO : constant := 14; SC_THREAD_PRIORITY_SCHEDULING : constant := 79; SC_THREAD_PRIO_INHERIT : constant := 80; SC_THREAD_PRIO_PROTECT : constant := 81; SC_TIMERS : constant := 11; SC_TIMER_MAX : constant := 35; SC_TZNAME_MAX : constant := 6; SC_T_IOV_MAX : constant := 66; SC_UIO_MAXIOV : constant := 60; SC_VERSION : constant := 29; ------------------------ -- type definitions -- ------------------------ type off_t is range -2**63 .. (2**63) - 1; for off_t'Size use 64; type pid_t is range -2**31 .. (2**31) - 1; for pid_t'Size use 32; type gid_t is mod 2**32; for gid_t'Size use 32; type uid_t is mod 2**32; for uid_t'Size use 32; type mode_t is mod 2**32; for mode_t'Size use 32; type suseconds_t is range -2**31 .. (2**31) - 1; for suseconds_t'Size use 32; type ssize_t is range -2**31 .. (2**31) - 1; for ssize_t'Size use 32; type DIR is array (1 .. 1) of int; for DIR'Alignment use ALIGNMENT; for DIR'Size use 32; type DIR_ptr is access constant DIR; pragma Convention (C, DIR_ptr); type DIR_var_ptr is access all DIR; pragma Convention (C, DIR_var_ptr); type ino_t is mod 2**64; for ino_t'Size use 64; type dev_t is mod 2**64; for dev_t'Size use 64; type cc_t is mod 2**8; for cc_t'Size use 8; type nlink_t is mod 2**32; for nlink_t'Size use 32; -- *** MISSING: blksize_t *** -- type blksize_t is mod 2**32; for blksize_t'Size use 32; -- *** MISSING: blkcnt_t *** -- type blkcnt_t is mod 2**32; for blkcnt_t'Size use 32; type tcflag_t is mod 2**32; for tcflag_t'Size use 32; type clockid_t is range -2**31 .. (2**31) - 1; for clockid_t'Size use 32; type mqd_t is range -2**31 .. (2**31) - 1; for mqd_t'Size use 32; type pthread_attr_t is array (1 .. 9) of int; for pthread_attr_t'Alignment use ALIGNMENT; for pthread_attr_t'Size use 288; type pthread_attr_t_ptr is access constant pthread_attr_t; pragma Convention (C, pthread_attr_t_ptr); type pthread_attr_t_var_ptr is access all pthread_attr_t; pragma Convention (C, pthread_attr_t_var_ptr); type pthread_cond_t is array (1 .. 12) of int; for pthread_cond_t'Alignment use ALIGNMENT; for pthread_cond_t'Size use 384; type pthread_cond_t_ptr is access constant pthread_cond_t; pragma Convention (C, pthread_cond_t_ptr); type pthread_cond_t_var_ptr is access all pthread_cond_t; pragma Convention (C, pthread_cond_t_var_ptr); type pthread_condattr_t is array (1 .. 1) of int; for pthread_condattr_t'Alignment use ALIGNMENT; for pthread_condattr_t'Size use 32; type pthread_condattr_t_ptr is access constant pthread_condattr_t; pragma Convention (C, pthread_condattr_t_ptr); type pthread_condattr_t_var_ptr is access all pthread_condattr_t; pragma Convention (C, pthread_condattr_t_var_ptr); type pthread_key_t is array (1 .. 1) of int; for pthread_key_t'Alignment use ALIGNMENT; for pthread_key_t'Size use 32; type pthread_key_t_ptr is access constant pthread_key_t; pragma Convention (C, pthread_key_t_ptr); type pthread_key_t_var_ptr is access all pthread_key_t; pragma Convention (C, pthread_key_t_var_ptr); type pthread_mutex_t is array (1 .. 6) of int; for pthread_mutex_t'Alignment use ALIGNMENT; for pthread_mutex_t'Size use 192; type pthread_mutex_t_ptr is access constant pthread_mutex_t; pragma Convention (C, pthread_mutex_t_ptr); type pthread_mutex_t_var_ptr is access all pthread_mutex_t; pragma Convention (C, pthread_mutex_t_var_ptr); type pthread_mutexattr_t is array (1 .. 1) of int; for pthread_mutexattr_t'Alignment use ALIGNMENT; for pthread_mutexattr_t'Size use 32; type pthread_mutexattr_t_ptr is access constant pthread_mutexattr_t; pragma Convention (C, pthread_mutexattr_t_ptr); type pthread_mutexattr_t_var_ptr is access all pthread_mutexattr_t; pragma Convention (C, pthread_mutexattr_t_var_ptr); type pthread_once_t is array (1 .. 1) of int; for pthread_once_t'Alignment use ALIGNMENT; for pthread_once_t'Size use 32; type pthread_once_t_ptr is access constant pthread_once_t; pragma Convention (C, pthread_once_t_ptr); type pthread_once_t_var_ptr is access all pthread_once_t; pragma Convention (C, pthread_once_t_var_ptr); type pthread_t is array (1 .. 1) of int; for pthread_t'Alignment use ALIGNMENT; for pthread_t'Size use 32; type pthread_t_ptr is access constant pthread_t; pragma Convention (C, pthread_t_ptr); type pthread_t_var_ptr is access all pthread_t; pragma Convention (C, pthread_t_var_ptr); type sem_t is array (1 .. 4) of int; for sem_t'Alignment use ALIGNMENT; for sem_t'Size use 128; type sem_t_ptr is access constant sem_t; pragma Convention (C, sem_t_ptr); type sem_t_var_ptr is access all sem_t; pragma Convention (C, sem_t_var_ptr); type sigset_t is array (1 .. 32) of int; for sigset_t'Alignment use ALIGNMENT; for sigset_t'Size use 1024; type sigset_t_ptr is access constant sigset_t; pragma Convention (C, sigset_t_ptr); type sigset_t_var_ptr is access all sigset_t; pragma Convention (C, sigset_t_var_ptr); type speed_t is mod 2**32; for speed_t'Size use 32; type socklen_t is mod 2**32; for socklen_t'Size use 32; type timer_t is mod 2**32; for timer_t'Size use 32; type sigval (Dummy : Boolean := True) is record case Dummy is when True => sival_int : int; when False => sival_ptr : System.Address; end case; end record; pragma Unchecked_Union (sigval); null_sigval : constant sigval := (Dummy => False, sival_ptr => System.Null_Address); sigval_byte_size : constant := 4; sigval_alignment : constant := ALIGNMENT; type siginfo_t is record si_signo : int; si_code : int; si_value : sigval; end record; for siginfo_t use record si_signo at 0 range 0 .. 31; si_code at 8 range 0 .. 31; si_value at 20 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, siginfo_t); for siginfo_t'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for siginfo_t'Size use 1024; pragma Warnings (On); type siginfo_t_ptr is access constant siginfo_t; pragma Convention (C, siginfo_t_ptr); type siginfo_t_var_ptr is access all siginfo_t; pragma Convention (C, siginfo_t_var_ptr); ----------------------- -- structure types -- ----------------------- type struct_sigevent is record sigev_notify : int; sigev_signo : int; sigev_value : sigval; sigev_notify_function : System.Address; sigev_notify_attributes : System.Address; end record; for struct_sigevent use record sigev_notify at 8 range 0 .. 31; sigev_signo at 4 range 0 .. 31; sigev_value at 0 range 0 .. 31; sigev_notify_function at 12 range 0 .. 31; sigev_notify_attributes at 16 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_sigevent); for struct_sigevent'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_sigevent'Size use 512; pragma Warnings (On); type sigevent_ptr is access constant struct_sigevent; pragma Convention (C, sigevent_ptr); type sigevent_var_ptr is access all struct_sigevent; pragma Convention (C, sigevent_var_ptr); type struct_aiocb is record aio_fildes : int; aio_offset : off_t; aio_buf : System.Address; pragma Volatile (aio_buf); aio_nbytes : size_t; aio_reqprio : int; aio_sigevent : struct_sigevent; aio_lio_opcode : int; end record; for struct_aiocb use record aio_fildes at 0 range 0 .. 31; aio_offset at 104 range 0 .. 63; aio_buf at 12 range 0 .. 31; aio_nbytes at 16 range 0 .. 31; aio_reqprio at 8 range 0 .. 31; aio_sigevent at 20 range 0 .. 511; aio_lio_opcode at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_aiocb); for struct_aiocb'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_aiocb'Size use 1152; pragma Warnings (On); type aiocb_ptr is access constant struct_aiocb; pragma Convention (C, aiocb_ptr); type aiocb_var_ptr is access all struct_aiocb; pragma Convention (C, aiocb_var_ptr); type struct_dirent is record d_name : POSIX_String (1 .. 1); end record; for struct_dirent use record d_name at 19 range 0 .. 7; end record; pragma Convention (C_Pass_By_Copy, struct_dirent); for struct_dirent'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_dirent'Size use 2240; pragma Warnings (On); type dirent_ptr is access constant struct_dirent; pragma Convention (C, dirent_ptr); type dirent_var_ptr is access all struct_dirent; pragma Convention (C, dirent_var_ptr); type struct_flock is record l_type : short; l_whence : short; l_start : off_t; l_len : off_t; l_pid : pid_t; end record; for struct_flock use record l_type at 0 range 0 .. 15; l_whence at 2 range 0 .. 15; l_start at 8 range 0 .. 63; l_len at 16 range 0 .. 63; l_pid at 24 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_flock); for struct_flock'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_flock'Size use 256; pragma Warnings (On); type flock_ptr is access constant struct_flock; pragma Convention (C, flock_ptr); type flock_var_ptr is access all struct_flock; pragma Convention (C, flock_var_ptr); type struct_group is record gr_name : char_ptr; gr_gid : gid_t; gr_mem : char_ptr_ptr; end record; for struct_group use record gr_name at 0 range 0 .. 31; gr_gid at 8 range 0 .. 31; gr_mem at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_group); for struct_group'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_group'Size use 128; pragma Warnings (On); type group_ptr is access constant struct_group; pragma Convention (C, group_ptr); type group_var_ptr is access all struct_group; pragma Convention (C, group_var_ptr); type struct_mq_attr is record mq_flags : long; mq_maxmsg : long; mq_msgsize : long; mq_curmsgs : long; end record; for struct_mq_attr use record mq_flags at 0 range 0 .. 31; mq_maxmsg at 4 range 0 .. 31; mq_msgsize at 8 range 0 .. 31; mq_curmsgs at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_mq_attr); for struct_mq_attr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_mq_attr'Size use 256; pragma Warnings (On); type mq_attr_ptr is access constant struct_mq_attr; pragma Convention (C, mq_attr_ptr); type mq_attr_var_ptr is access all struct_mq_attr; pragma Convention (C, mq_attr_var_ptr); type struct_passwd is record pw_name : char_ptr; pw_uid : uid_t; pw_gid : gid_t; pw_dir : char_ptr; pw_shell : char_ptr; end record; for struct_passwd use record pw_name at 0 range 0 .. 31; pw_uid at 8 range 0 .. 31; pw_gid at 12 range 0 .. 31; pw_dir at 20 range 0 .. 31; pw_shell at 24 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_passwd); for struct_passwd'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_passwd'Size use 224; pragma Warnings (On); type passwd_ptr is access constant struct_passwd; pragma Convention (C, passwd_ptr); type passwd_var_ptr is access all struct_passwd; pragma Convention (C, passwd_var_ptr); type struct_sigaction is record sa_handler : System.Address; sa_mask : sigset_t; sa_flags : int; end record; for struct_sigaction use record sa_handler at 0 range 0 .. 31; sa_mask at 4 range 0 .. 1023; sa_flags at 132 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_sigaction); for struct_sigaction'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_sigaction'Size use 1120; pragma Warnings (On); type sigaction_ptr is access constant struct_sigaction; pragma Convention (C, sigaction_ptr); type sigaction_var_ptr is access all struct_sigaction; pragma Convention (C, sigaction_var_ptr); type struct_sched_param is record sched_priority : int; end record; for struct_sched_param use record sched_priority at 0 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_sched_param); for struct_sched_param'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_sched_param'Size use 32; pragma Warnings (On); type sched_param_ptr is access constant struct_sched_param; pragma Convention (C, sched_param_ptr); type sched_param_var_ptr is access all struct_sched_param; pragma Convention (C, sched_param_var_ptr); type cc_t_array is array (0 .. NCCS - 1) of cc_t; type struct_stat is record st_mode : mode_t; st_ino : ino_t; st_dev : dev_t; st_nlink : nlink_t; st_uid : uid_t; st_gid : gid_t; st_size : off_t; st_blksize : blksize_t; st_blocks : blkcnt_t; st_atime : time_t; st_mtime : time_t; st_ctime : time_t; end record; for struct_stat use record st_mode at 16 range 0 .. 31; st_ino at 8 range 0 .. 63; st_dev at 0 range 0 .. 63; st_nlink at 20 range 0 .. 31; st_uid at 24 range 0 .. 31; st_gid at 28 range 0 .. 31; st_size at 48 range 0 .. 63; st_blksize at 56 range 0 .. 31; st_blocks at 64 range 0 .. 63; st_atime at 72 range 0 .. 31; st_mtime at 80 range 0 .. 31; st_ctime at 88 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_stat); for struct_stat'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_stat'Size use 832; pragma Warnings (On); type stat_ptr is access constant struct_stat; pragma Convention (C, stat_ptr); type stat_var_ptr is access all struct_stat; pragma Convention (C, stat_var_ptr); function To_Stat_Ptr is new Unchecked_Conversion (Address, stat_ptr); type struct_termios is record c_iflag : tcflag_t; c_oflag : tcflag_t; c_cflag : tcflag_t; c_lflag : tcflag_t; c_cc : cc_t_array; end record; for struct_termios use record c_iflag at 0 range 0 .. 31; c_oflag at 4 range 0 .. 31; c_cflag at 8 range 0 .. 31; c_lflag at 12 range 0 .. 31; c_cc at 17 range 0 .. 255; end record; pragma Convention (C_Pass_By_Copy, struct_termios); for struct_termios'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_termios'Size use 480; pragma Warnings (On); type termios_ptr is access constant struct_termios; pragma Convention (C, termios_ptr); type termios_var_ptr is access all struct_termios; pragma Convention (C, termios_var_ptr); -- timeval structure -- type struct_timeval is record tv_sec : time_t; tv_usec : suseconds_t; end record; for struct_timeval use record tv_sec at 0 range 0 .. 31; tv_usec at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_timeval); for struct_timeval'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_timeval'Size use 64; pragma Warnings (On); type timeval_ptr is access constant struct_timeval; pragma Convention (C, timeval_ptr); type timeval_var_ptr is access all struct_timeval; pragma Convention (C, timeval_var_ptr); type struct_timespec is record tv_sec : time_t; tv_nsec : long; end record; for struct_timespec use record tv_sec at 0 range 0 .. 31; tv_nsec at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_timespec); for struct_timespec'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_timespec'Size use 64; pragma Warnings (On); type timespec_ptr is access constant struct_timespec; pragma Convention (C, timespec_ptr); type timespec_var_ptr is access all struct_timespec; pragma Convention (C, timespec_var_ptr); type struct_itimerspec is record it_interval : struct_timespec; it_value : struct_timespec; end record; for struct_itimerspec use record it_interval at 0 range 0 .. 63; it_value at 8 range 0 .. 63; end record; pragma Convention (C_Pass_By_Copy, struct_itimerspec); for struct_itimerspec'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_itimerspec'Size use 128; pragma Warnings (On); type itimerspec_ptr is access constant struct_itimerspec; pragma Convention (C, itimerspec_ptr); type itimerspec_var_ptr is access all struct_itimerspec; pragma Convention (C, itimerspec_var_ptr); type struct_tm is record tm_sec : int; tm_min : int; tm_hour : int; tm_mday : int; tm_mon : int; tm_year : int; tm_wday : int; tm_yday : int; tm_isdst : int; end record; for struct_tm use record tm_sec at 0 range 0 .. 31; tm_min at 4 range 0 .. 31; tm_hour at 8 range 0 .. 31; tm_mday at 12 range 0 .. 31; tm_mon at 16 range 0 .. 31; tm_year at 20 range 0 .. 31; tm_wday at 24 range 0 .. 31; tm_yday at 28 range 0 .. 31; tm_isdst at 32 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_tm); for struct_tm'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_tm'Size use 352; pragma Warnings (On); type tm_ptr is access constant struct_tm; pragma Convention (C, tm_ptr); type tm_var_ptr is access all struct_tm; pragma Convention (C, tm_var_ptr); type struct_tms is record tms_utime : clock_t; tms_stime : clock_t; tms_cutime : clock_t; tms_cstime : clock_t; end record; for struct_tms use record tms_utime at 0 range 0 .. 31; tms_stime at 4 range 0 .. 31; tms_cutime at 8 range 0 .. 31; tms_cstime at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_tms); for struct_tms'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_tms'Size use 128; pragma Warnings (On); type tms_ptr is access constant struct_tms; pragma Convention (C, tms_ptr); type tms_var_ptr is access all struct_tms; pragma Convention (C, tms_var_ptr); type struct_utimbuf is record modtime : time_t; actime : time_t; end record; for struct_utimbuf use record modtime at 4 range 0 .. 31; actime at 0 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_utimbuf); for struct_utimbuf'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_utimbuf'Size use 64; pragma Warnings (On); type utimbuf_ptr is access constant struct_utimbuf; pragma Convention (C, utimbuf_ptr); type utimbuf_var_ptr is access all struct_utimbuf; pragma Convention (C, utimbuf_var_ptr); subtype utsname_sysname_string is POSIX_String (1 .. 65); subtype utsname_nodename_string is POSIX_String (1 .. 65); subtype utsname_release_string is POSIX_String (1 .. 65); subtype utsname_version_string is POSIX_String (1 .. 65); subtype utsname_machine_string is POSIX_String (1 .. 65); type struct_utsname is record sysname : utsname_sysname_string; nodename : utsname_nodename_string; release : utsname_release_string; version : utsname_version_string; machine : utsname_machine_string; end record; for struct_utsname use record sysname at 0 range 0 .. 519; nodename at 65 range 0 .. 519; release at 130 range 0 .. 519; version at 195 range 0 .. 519; machine at 260 range 0 .. 519; end record; pragma Convention (C_Pass_By_Copy, struct_utsname); for struct_utsname'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_utsname'Size use 3120; pragma Warnings (On); type utsname_ptr is access constant struct_utsname; pragma Convention (C, utsname_ptr); type utsname_var_ptr is access all struct_utsname; pragma Convention (C, utsname_var_ptr); ---------------------------------- -- link names for C functions -- ---------------------------------- HAVE_access : constant Boolean := True; access_LINKNAME : constant String := "access"; HAVE_aio_cancel : constant Boolean := True; aio_cancel_LINKNAME : constant String := "aio_cancel"; HAVE_aio_error : constant Boolean := True; aio_error_LINKNAME : constant String := "aio_error"; HAVE_aio_fsync : constant Boolean := True; aio_fsync_LINKNAME : constant String := "aio_fsync"; HAVE_aio_read : constant Boolean := True; aio_read_LINKNAME : constant String := "aio_read"; HAVE_aio_return : constant Boolean := True; aio_return_LINKNAME : constant String := "aio_return"; HAVE_aio_suspend : constant Boolean := True; aio_suspend_LINKNAME : constant String := "aio_suspend"; HAVE_aio_write : constant Boolean := True; aio_write_LINKNAME : constant String := "aio_write"; HAVE_cfgetispeed : constant Boolean := True; cfgetispeed_LINKNAME : constant String := "cfgetispeed"; HAVE_cfgetospeed : constant Boolean := True; cfgetospeed_LINKNAME : constant String := "cfgetospeed"; HAVE_cfsetispeed : constant Boolean := True; cfsetispeed_LINKNAME : constant String := "cfsetispeed"; HAVE_cfsetospeed : constant Boolean := True; cfsetospeed_LINKNAME : constant String := "cfsetospeed"; HAVE_chdir : constant Boolean := True; chdir_LINKNAME : constant String := "chdir"; HAVE_chmod : constant Boolean := True; chmod_LINKNAME : constant String := "chmod"; HAVE_chown : constant Boolean := True; chown_LINKNAME : constant String := "chown"; HAVE_clock_getres : constant Boolean := True; clock_getres_LINKNAME : constant String := "clock_getres"; HAVE_clock_gettime : constant Boolean := True; clock_gettime_LINKNAME : constant String := "clock_gettime"; HAVE_clock_settime : constant Boolean := True; clock_settime_LINKNAME : constant String := "clock_settime"; HAVE_close : constant Boolean := True; close_LINKNAME : constant String := "close"; HAVE_closedir : constant Boolean := True; closedir_LINKNAME : constant String := "closedir"; HAVE_ctermid : constant Boolean := True; ctermid_LINKNAME : constant String := "ctermid"; HAVE_ctime : constant Boolean := True; ctime_LINKNAME : constant String := "ctime"; HAVE_ctime_r : constant Boolean := True; ctime_r_LINKNAME : constant String := "ctime_r"; HAVE_dup : constant Boolean := True; dup_LINKNAME : constant String := "dup"; HAVE_dup2 : constant Boolean := True; dup2_LINKNAME : constant String := "dup2"; HAVE_execv : constant Boolean := True; execv_LINKNAME : constant String := "execv"; HAVE_execve : constant Boolean := True; execve_LINKNAME : constant String := "execve"; HAVE_execvp : constant Boolean := True; execvp_LINKNAME : constant String := "execvp"; HAVE_fchmod : constant Boolean := True; fchmod_LINKNAME : constant String := "fchmod"; HAVE_fcntl : constant Boolean := True; fcntl_LINKNAME : constant String := "fcntl"; HAVE_fdatasync : constant Boolean := True; fdatasync_LINKNAME : constant String := "fdatasync"; HAVE_fork : constant Boolean := True; fork_LINKNAME : constant String := "fork"; HAVE_fpathconf : constant Boolean := True; fpathconf_LINKNAME : constant String := "fpathconf"; HAVE_fstat : constant Boolean := True; fstat_LINKNAME : constant String := "__gnat_florist_fstat"; HAVE_fsync : constant Boolean := True; fsync_LINKNAME : constant String := "fsync"; HAVE_ftruncate : constant Boolean := True; ftruncate_LINKNAME : constant String := "ftruncate64"; HAVE_getcwd : constant Boolean := True; getcwd_LINKNAME : constant String := "getcwd"; HAVE_getegid : constant Boolean := True; getegid_LINKNAME : constant String := "getegid"; HAVE_getenv : constant Boolean := True; getenv_LINKNAME : constant String := "getenv"; HAVE_geteuid : constant Boolean := True; geteuid_LINKNAME : constant String := "geteuid"; HAVE_getgid : constant Boolean := True; getgid_LINKNAME : constant String := "getgid"; HAVE_getgrgid : constant Boolean := True; getgrgid_LINKNAME : constant String := "getgrgid"; HAVE_getgrnam : constant Boolean := True; getgrnam_LINKNAME : constant String := "getgrnam"; HAVE_getgroups : constant Boolean := True; getgroups_LINKNAME : constant String := "getgroups"; HAVE_getlogin : constant Boolean := True; getlogin_LINKNAME : constant String := "getlogin"; HAVE_getpgrp : constant Boolean := True; getpgrp_LINKNAME : constant String := "getpgrp"; HAVE_getpid : constant Boolean := True; getpid_LINKNAME : constant String := "getpid"; HAVE_getppid : constant Boolean := True; getppid_LINKNAME : constant String := "getppid"; HAVE_getpwnam : constant Boolean := True; getpwnam_LINKNAME : constant String := "getpwnam"; HAVE_getpwuid : constant Boolean := True; getpwuid_LINKNAME : constant String := "getpwuid"; HAVE_gettimeofday : constant Boolean := True; gettimeofday_LINKNAME : constant String := "gettimeofday"; HAVE_getuid : constant Boolean := True; getuid_LINKNAME : constant String := "getuid"; HAVE_gmtime_r : constant Boolean := True; gmtime_r_LINKNAME : constant String := "gmtime_r"; HAVE_isatty : constant Boolean := True; isatty_LINKNAME : constant String := "isatty"; HAVE_kill : constant Boolean := True; kill_LINKNAME : constant String := "kill"; HAVE_link : constant Boolean := True; link_LINKNAME : constant String := "link"; HAVE_lio_listio : constant Boolean := True; lio_listio_LINKNAME : constant String := "lio_listio"; HAVE_lstat : constant Boolean := True; lstat_LINKNAME : constant String := "__gnat_florist_lstat"; HAVE_lseek : constant Boolean := True; lseek_LINKNAME : constant String := "lseek64"; HAVE_mkdir : constant Boolean := True; mkdir_LINKNAME : constant String := "mkdir"; HAVE_mkfifo : constant Boolean := True; mkfifo_LINKNAME : constant String := "mkfifo"; HAVE_mlock : constant Boolean := True; mlock_LINKNAME : constant String := "mlock"; HAVE_mlockall : constant Boolean := True; mlockall_LINKNAME : constant String := "mlockall"; HAVE_mmap : constant Boolean := True; mmap_LINKNAME : constant String := "mmap"; HAVE_mprotect : constant Boolean := True; mprotect_LINKNAME : constant String := "mprotect"; HAVE_mq_close : constant Boolean := True; mq_close_LINKNAME : constant String := "mq_close"; HAVE_mq_getattr : constant Boolean := True; mq_getattr_LINKNAME : constant String := "mq_getattr"; HAVE_mq_notify : constant Boolean := True; mq_notify_LINKNAME : constant String := "mq_notify"; HAVE_mq_open : constant Boolean := True; mq_open_LINKNAME : constant String := "mq_open"; HAVE_mq_receive : constant Boolean := True; mq_receive_LINKNAME : constant String := "mq_receive"; HAVE_mq_send : constant Boolean := True; mq_send_LINKNAME : constant String := "mq_send"; HAVE_mq_setattr : constant Boolean := True; mq_setattr_LINKNAME : constant String := "mq_setattr"; HAVE_mq_unlink : constant Boolean := True; mq_unlink_LINKNAME : constant String := "mq_unlink"; HAVE_msync : constant Boolean := True; msync_LINKNAME : constant String := "msync"; HAVE_munlock : constant Boolean := True; munlock_LINKNAME : constant String := "munlock"; HAVE_munlockall : constant Boolean := True; munlockall_LINKNAME : constant String := "munlockall"; HAVE_munmap : constant Boolean := True; munmap_LINKNAME : constant String := "munmap"; HAVE_open : constant Boolean := True; open_LINKNAME : constant String := "__gnat_florist_open"; HAVE_opendir : constant Boolean := True; opendir_LINKNAME : constant String := "opendir"; HAVE_pathconf : constant Boolean := True; pathconf_LINKNAME : constant String := "pathconf"; HAVE_pipe : constant Boolean := True; pipe_LINKNAME : constant String := "pipe"; pthread_cond_broadcast_LINKNAME : constant String := "pthread_cond_broadcast"; pthread_cond_destroy_LINKNAME : constant String := "pthread_cond_destroy"; pthread_cond_init_LINKNAME : constant String := "pthread_cond_init"; pthread_cond_signal_LINKNAME : constant String := "pthread_cond_signal"; pthread_cond_timedwait_LINKNAME : constant String := "pthread_cond_timedwait"; pthread_cond_wait_LINKNAME : constant String := "pthread_cond_wait"; pthread_condattr_destroy_LINKNAME : constant String := "pthread_condattr_destroy"; -- *** MISSING: function pthread_condattr_getpshared *** -- pthread_condattr_getpshared_LINKNAME : constant String := "nosys_direct"; pthread_condattr_init_LINKNAME : constant String := "pthread_condattr_init"; -- *** MISSING: function pthread_condattr_setpshared *** -- pthread_condattr_setpshared_LINKNAME : constant String := "nosys_direct"; pthread_mutex_destroy_LINKNAME : constant String := "pthread_mutex_destroy"; -- *** MISSING: function pthread_mutex_getprioceiling *** -- pthread_mutex_getprioceiling_LINKNAME : constant String := "nosys_direct"; pthread_mutex_init_LINKNAME : constant String := "pthread_mutex_init"; pthread_mutex_lock_LINKNAME : constant String := "pthread_mutex_lock"; -- *** MISSING: function pthread_mutex_setprioceiling *** -- pthread_mutex_setprioceiling_LINKNAME : constant String := "nosys_direct"; -- *** MISSING: function pthread_mutex_trylock *** -- pthread_mutex_trylock_LINKNAME : constant String := "nosys_direct"; pthread_mutex_unlock_LINKNAME : constant String := "pthread_mutex_unlock"; -- *** MISSING: function pthread_mutexattr_destroy *** -- pthread_mutexattr_destroy_LINKNAME : constant String := "nosys_direct"; -- *** MISSING: function pthread_mutexattr_getprioceiling *** -- pthread_mutexattr_getprioceiling_LINKNAME : constant String := "nosys_direct"; -- *** MISSING: function pthread_mutexattr_getprotocol *** -- pthread_mutexattr_getprotocol_LINKNAME : constant String := "nosys_direct"; -- *** MISSING: function pthread_mutexattr_getpshared *** -- pthread_mutexattr_getpshared_LINKNAME : constant String := "nosys_direct"; -- *** MISSING: function pthread_mutexattr_init *** -- pthread_mutexattr_init_LINKNAME : constant String := "nosys_direct"; -- *** MISSING: function pthread_mutexattr_setprioceiling *** -- pthread_mutexattr_setprioceiling_LINKNAME : constant String := "nosys_direct"; -- *** MISSING: function pthread_mutexattr_setprotocol *** -- pthread_mutexattr_setprotocol_LINKNAME : constant String := "nosys_direct"; -- *** MISSING: function pthread_mutexattr_setpshared *** -- pthread_mutexattr_setpshared_LINKNAME : constant String := "nosys_direct"; -- *** MISSING: function pthread_sigmask *** -- pthread_sigmask_LINKNAME : constant String := "nosys_direct"; HAVE_putenv : constant Boolean := True; putenv_LINKNAME : constant String := "putenv"; HAVE_read : constant Boolean := True; read_LINKNAME : constant String := "read"; HAVE_readdir : constant Boolean := True; readdir_LINKNAME : constant String := "readdir64"; HAVE_readdir_r : constant Boolean := True; readdir_r_LINKNAME : constant String := "readdir64_r"; HAVE_rename : constant Boolean := True; rename_LINKNAME : constant String := "rename"; HAVE_rmdir : constant Boolean := True; rmdir_LINKNAME : constant String := "rmdir"; HAVE_sched_get_priority_max : constant Boolean := True; sched_get_priority_max_LINKNAME : constant String := "sched_get_priority_max"; HAVE_sched_get_priority_min : constant Boolean := True; sched_get_priority_min_LINKNAME : constant String := "sched_get_priority_min"; HAVE_sched_rr_get_interval : constant Boolean := True; sched_rr_get_interval_LINKNAME : constant String := "sched_rr_get_interval"; HAVE_sched_getparam : constant Boolean := True; sched_getparam_LINKNAME : constant String := "sched_getparam"; HAVE_sched_getscheduler : constant Boolean := True; sched_getscheduler_LINKNAME : constant String := "sched_getscheduler"; HAVE_sched_setparam : constant Boolean := True; sched_setparam_LINKNAME : constant String := "sched_setparam"; HAVE_sched_setscheduler : constant Boolean := True; sched_setscheduler_LINKNAME : constant String := "sched_setscheduler"; HAVE_sched_yield : constant Boolean := True; sched_yield_LINKNAME : constant String := "sched_yield"; -- *** MISSING: function sem_close *** -- HAVE_sem_close : constant Boolean := False; sem_close_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function sem_destroy *** -- HAVE_sem_destroy : constant Boolean := False; sem_destroy_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function sem_getvalue *** -- HAVE_sem_getvalue : constant Boolean := False; sem_getvalue_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function sem_init *** -- HAVE_sem_init : constant Boolean := False; sem_init_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function sem_open *** -- HAVE_sem_open : constant Boolean := False; sem_open_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function sem_post *** -- HAVE_sem_post : constant Boolean := False; sem_post_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function sem_trywait *** -- HAVE_sem_trywait : constant Boolean := False; sem_trywait_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function sem_unlink *** -- HAVE_sem_unlink : constant Boolean := False; sem_unlink_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function sem_wait *** -- HAVE_sem_wait : constant Boolean := False; sem_wait_LINKNAME : constant String := "nosys_neg_one"; HAVE_setenv : constant Boolean := True; setenv_LINKNAME : constant String := "setenv"; HAVE_setgid : constant Boolean := True; setgid_LINKNAME : constant String := "setgid"; HAVE_setpgid : constant Boolean := True; setpgid_LINKNAME : constant String := "setpgid"; HAVE_setsid : constant Boolean := True; setsid_LINKNAME : constant String := "setsid"; HAVE_setuid : constant Boolean := True; setuid_LINKNAME : constant String := "setuid"; HAVE_shm_open : constant Boolean := True; shm_open_LINKNAME : constant String := "shm_open"; HAVE_shm_unlink : constant Boolean := True; shm_unlink_LINKNAME : constant String := "shm_unlink"; HAVE_sigaction : constant Boolean := True; sigaction_LINKNAME : constant String := "sigaction"; HAVE_sigaddset : constant Boolean := True; sigaddset_LINKNAME : constant String := "sigaddset"; HAVE_sigdelset : constant Boolean := True; sigdelset_LINKNAME : constant String := "sigdelset"; HAVE_sigemptyset : constant Boolean := True; sigemptyset_LINKNAME : constant String := "sigemptyset"; HAVE_sigfillset : constant Boolean := True; sigfillset_LINKNAME : constant String := "sigfillset"; HAVE_sigismember : constant Boolean := True; sigismember_LINKNAME : constant String := "sigismember"; HAVE_sigpending : constant Boolean := True; sigpending_LINKNAME : constant String := "sigpending"; HAVE_sigprocmask : constant Boolean := True; sigprocmask_LINKNAME : constant String := "sigprocmask"; HAVE_sigqueue : constant Boolean := True; sigqueue_LINKNAME : constant String := "sigqueue"; HAVE_sigtimedwait : constant Boolean := True; sigtimedwait_LINKNAME : constant String := "sigtimedwait"; HAVE_sigwait : constant Boolean := True; sigwait_LINKNAME : constant String := "sigwait"; HAVE_sigwaitinfo : constant Boolean := True; sigwaitinfo_LINKNAME : constant String := "sigwaitinfo"; HAVE_stat : constant Boolean := True; stat_LINKNAME : constant String := "__gnat_florist_stat"; HAVE_sysconf : constant Boolean := True; sysconf_LINKNAME : constant String := "sysconf"; HAVE_tcdrain : constant Boolean := True; tcdrain_LINKNAME : constant String := "tcdrain"; HAVE_tcflow : constant Boolean := True; tcflow_LINKNAME : constant String := "tcflow"; HAVE_tcflush : constant Boolean := True; tcflush_LINKNAME : constant String := "tcflush"; HAVE_tcgetattr : constant Boolean := True; tcgetattr_LINKNAME : constant String := "tcgetattr"; HAVE_tcgetpgrp : constant Boolean := True; tcgetpgrp_LINKNAME : constant String := "tcgetpgrp"; HAVE_tcsendbreak : constant Boolean := True; tcsendbreak_LINKNAME : constant String := "tcsendbreak"; HAVE_tcsetattr : constant Boolean := True; tcsetattr_LINKNAME : constant String := "tcsetattr"; HAVE_tcsetpgrp : constant Boolean := True; tcsetpgrp_LINKNAME : constant String := "tcsetpgrp"; HAVE_time : constant Boolean := True; time_LINKNAME : constant String := "time"; HAVE_timer_create : constant Boolean := True; timer_create_LINKNAME : constant String := "timer_create"; HAVE_timer_delete : constant Boolean := True; timer_delete_LINKNAME : constant String := "timer_delete"; HAVE_timer_getoverrun : constant Boolean := True; timer_getoverrun_LINKNAME : constant String := "timer_getoverrun"; HAVE_timer_gettime : constant Boolean := True; timer_gettime_LINKNAME : constant String := "timer_gettime"; HAVE_timer_settime : constant Boolean := True; timer_settime_LINKNAME : constant String := "timer_settime"; HAVE_times : constant Boolean := True; times_LINKNAME : constant String := "times"; HAVE_ttyname : constant Boolean := True; ttyname_LINKNAME : constant String := "ttyname"; HAVE_umask : constant Boolean := True; umask_LINKNAME : constant String := "umask"; HAVE_uname : constant Boolean := True; uname_LINKNAME : constant String := "__gnat_florist_uname"; HAVE_unlink : constant Boolean := True; unlink_LINKNAME : constant String := "unlink"; HAVE_unsetenv : constant Boolean := True; unsetenv_LINKNAME : constant String := "unsetenv"; HAVE_utime : constant Boolean := True; utime_LINKNAME : constant String := "utime"; HAVE_waitpid : constant Boolean := True; waitpid_LINKNAME : constant String := "waitpid"; HAVE_write : constant Boolean := True; write_LINKNAME : constant String := "write"; ------------------------------ -- C functions for macros -- ------------------------------ function s_isdir (mode : mode_t) return int; pragma Import (C, s_isdir, "s_isdir"); function s_ischr (mode : mode_t) return int; pragma Import (C, s_ischr, "s_ischr"); function s_isblk (mode : mode_t) return int; pragma Import (C, s_isblk, "s_isblk"); function s_islnk (mode : mode_t) return int; pragma Import (C, s_islnk, "s_islnk"); function s_isreg (mode : mode_t) return int; pragma Import (C, s_isreg, "s_isreg"); function s_isfifo (mode : mode_t) return int; pragma Import (C, s_isfifo, "s_isfifo"); function s_ismsg (mode : mode_t) return int; pragma Import (C, s_ismsg, "s_ismsg"); function s_issem (mode : mode_t) return int; pragma Import (C, s_issem, "s_issem"); function s_isshm (mode : mode_t) return int; pragma Import (C, s_isshm, "s_isshm"); function s_issock (mode : mode_t) return int; pragma Import (C, s_issock, "s_issock"); function s_typeismq (stat : stat_ptr) return int; pragma Import (C, s_typeismq, "s_typeismq"); function s_typeissem (stat : stat_ptr) return int; pragma Import (C, s_typeissem, "s_typeissem"); function s_typeisshm (stat : stat_ptr) return int; pragma Import (C, s_typeisshm, "s_typeisshm"); function wifexited (stat_val : int) return int; pragma Import (C, wifexited, "wifexited"); function wifexitstatus (stat_val : int) return int; pragma Import (C, wifexitstatus, "wifexitstatus"); function wifsignaled (stat_val : int) return int; pragma Import (C, wifsignaled, "wifsignaled"); function wiftermsig (stat_val : int) return int; pragma Import (C, wiftermsig, "wiftermsig"); function wifstopped (stat_val : int) return int; pragma Import (C, wifstopped, "wifstopped"); function wifstopsig (stat_val : int) return int; pragma Import (C, wifstopsig, "wifstopsig"); package Sockets is ---------------- -- socket.h -- ---------------- type sa_family_t is mod 2**16; for sa_family_t'Size use 16; type in_port_t is mod 2**16; for in_port_t'Size use 16; ----------------- -- constants -- ----------------- HOST_NOT_FOUND : constant := 1; NO_DATA : constant := 4; NO_RECOVERY : constant := 3; TRY_AGAIN : constant := 2; -- *** MISSING: MAX_SOCKADDR_EXT *** -- MAX_SOCKADDR_EXT : constant := 108; -- sockets protocol level -- SOL_SOCKET : constant := 1; -- socket types -- SOCK_STREAM : constant := 1; SOCK_DGRAM : constant := 2; SOCK_RAW : constant := 3; SOCK_SEQPACKET : constant := 5; -- address families -- AF_MAX : constant := 37; AF_UNSPEC : constant := 0; AF_UNIX : constant := 1; AF_LOCAL : constant := 1; AF_INET : constant := 2; -- *** MISSING: AF_OSI *** -- AF_OSI : constant := 0; -- *** MISSING: AF_ISO *** -- AF_ISO : constant := 0; -- protocol families -- PF_MAX : constant := 37; PF_UNSPEC : constant := 0; PF_LOCAL : constant := 1; PF_UNIX : constant := 1; PF_INET : constant := 2; -- *** MISSING: PF_OSI *** -- PF_OSI : constant := 0; -- *** MISSING: PF_ISO *** -- PF_ISO : constant := 0; -- socket options -- SO_BROADCAST : constant := 6; SO_DEBUG : constant := 1; SO_DONTROUTE : constant := 5; SO_ERROR : constant := 4; SO_KEEPALIVE : constant := 9; SO_LINGER : constant := 13; SO_OOBINLINE : constant := 10; SO_RCVBUF : constant := 8; SO_RCVLOWAT : constant := 16; SO_RCVTIMEO : constant := 18; SO_REUSEADDR : constant := 2; SO_SNDBUF : constant := 7; SO_SNDLOWAT : constant := 17; SO_SNDTIMEO : constant := 19; SO_TYPE : constant := 3; -- max queued connections -- SOMAXCONN : constant := 128; -- send & receive option flag bits -- MSG_OOB : constant := 1; MSG_PEEK : constant := 2; MSG_DONTROUTE : constant := 4; MSG_EOR : constant := 128; MSG_TRUNC : constant := 32; MSG_CTRUNC : constant := 8; MSG_WAITALL : constant := 256; -- *** MISSING: MSG_MAXIOVLEN *** -- MSG_MAXIOVLEN : constant := 0; -- socket address information option flag bits -- AI_PASSIVE : constant := 1; AI_CANONNAME : constant := 2; -- scoket shutdown mode flag bits -- SHUT_RD : constant := 0; SHUT_WR : constant := 1; SHUT_RDWR : constant := 2; ------------------ -- structures -- ------------------ -- generic socket address -- type struct_sockaddr is record sa_family : sa_family_t; sa_data : POSIX_String (1 .. 14); end record; for struct_sockaddr use record sa_family at 0 range 0 .. 15; sa_data at 2 range 0 .. 111; end record; pragma Convention (C_Pass_By_Copy, struct_sockaddr); for struct_sockaddr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_sockaddr'Size use 128; pragma Warnings (On); type sockaddr_ptr is access constant struct_sockaddr; pragma Convention (C, sockaddr_ptr); type sockaddr_var_ptr is access all struct_sockaddr; pragma Convention (C, sockaddr_var_ptr); -- struct addrinfo... -- type struct_addrinfo; type addrinfo_ptr is access constant struct_addrinfo; pragma Convention (C, addrinfo_ptr); type addrinfo_var_ptr is access all struct_addrinfo; pragma Convention (C, addrinfo_var_ptr); type struct_addrinfo is record ai_flags : int; ai_family : int; ai_socktype : int; ai_protocol : int; ai_addrlen : size_t; ai_addr : sockaddr_ptr; ai_canonname : char_ptr; ai_next : addrinfo_ptr; end record; for struct_addrinfo use record ai_flags at 0 range 0 .. 31; ai_family at 4 range 0 .. 31; ai_socktype at 8 range 0 .. 31; ai_protocol at 12 range 0 .. 31; ai_addrlen at 16 range 0 .. 31; ai_addr at 20 range 0 .. 31; ai_canonname at 24 range 0 .. 31; ai_next at 28 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_addrinfo); for struct_addrinfo'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_addrinfo'Size use 256; pragma Warnings (On); -- message option header -- type struct_cmsghdr is record cmsg_level : int; cmsg_type : int; cmsg_len : socklen_t; end record; for struct_cmsghdr use record cmsg_level at 4 range 0 .. 31; cmsg_type at 8 range 0 .. 31; cmsg_len at 0 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_cmsghdr); for struct_cmsghdr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_cmsghdr'Size use 96; pragma Warnings (On); type cmsghdr_ptr is access constant struct_cmsghdr; pragma Convention (C, cmsghdr_ptr); type cmsghdr_var_ptr is access all struct_cmsghdr; pragma Convention (C, cmsghdr_var_ptr); -- host database entry -- type struct_hostent is record h_name : char_ptr; h_aliases : char_ptr_ptr; h_addrtype : int; h_length : int; h_addr_list : char_ptr_ptr; end record; for struct_hostent use record h_name at 0 range 0 .. 31; h_aliases at 4 range 0 .. 31; h_addrtype at 8 range 0 .. 31; h_length at 12 range 0 .. 31; h_addr_list at 16 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_hostent); for struct_hostent'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_hostent'Size use 160; pragma Warnings (On); type hostent_ptr is access constant struct_hostent; pragma Convention (C, hostent_ptr); type hostent_var_ptr is access all struct_hostent; pragma Convention (C, hostent_var_ptr); -- internet address -- type in_addr_t is mod 2**32; for in_addr_t'Size use 32; type struct_in_addr is record s_addr : in_addr_t; end record; for struct_in_addr use record s_addr at 0 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_in_addr); for struct_in_addr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_in_addr'Size use 32; pragma Warnings (On); type in_addr_ptr is access constant struct_in_addr; pragma Convention (C, in_addr_ptr); type in_addr_var_ptr is access all struct_in_addr; pragma Convention (C, in_addr_var_ptr); -- linger option structure -- type struct_linger is record l_onoff : int; l_linger : int; end record; for struct_linger use record l_onoff at 0 range 0 .. 31; l_linger at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_linger); for struct_linger'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_linger'Size use 64; pragma Warnings (On); type linger_ptr is access constant struct_linger; pragma Convention (C, linger_ptr); type linger_var_ptr is access all struct_linger; pragma Convention (C, linger_var_ptr); -- I/O vector -- type struct_iovec is record iov_base : char_ptr; iov_len : size_t; end record; for struct_iovec use record iov_base at 0 range 0 .. 31; iov_len at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_iovec); for struct_iovec'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_iovec'Size use 64; pragma Warnings (On); type iovec_ptr is access constant struct_iovec; pragma Convention (C, iovec_ptr); type iovec_var_ptr is access all struct_iovec; pragma Convention (C, iovec_var_ptr); -- message header -- type struct_msghdr is record msg_name : sockaddr_ptr; msg_namelen : size_t; msg_iov : iovec_ptr; msg_iovlen : size_t; msg_control : char_ptr; msg_controllen : socklen_t; msg_flags : int; end record; for struct_msghdr use record msg_name at 0 range 0 .. 31; msg_namelen at 4 range 0 .. 31; msg_iov at 8 range 0 .. 31; msg_iovlen at 12 range 0 .. 31; msg_control at 16 range 0 .. 31; msg_controllen at 20 range 0 .. 31; msg_flags at 24 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_msghdr); for struct_msghdr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_msghdr'Size use 224; pragma Warnings (On); type msghdr_ptr is access constant struct_msghdr; pragma Convention (C, msghdr_ptr); type msghdr_var_ptr is access all struct_msghdr; pragma Convention (C, msghdr_var_ptr); -- local socket address -- subtype sun_path_string is POSIX_String (1 .. 108); type struct_sockaddr_un is record sun_family : sa_family_t; sun_path : sun_path_string; end record; for struct_sockaddr_un use record sun_family at 0 range 0 .. 15; sun_path at 2 range 0 .. 863; end record; pragma Convention (C_Pass_By_Copy, struct_sockaddr_un); for struct_sockaddr_un'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_sockaddr_un'Size use 880; pragma Warnings (On); type sockaddr_un_ptr is access constant struct_sockaddr_un; pragma Convention (C, sockaddr_un_ptr); type sockaddr_un_var_ptr is access all struct_sockaddr_un; pragma Convention (C, sockaddr_un_var_ptr); -- internet socket address -- type struct_sockaddr_in is record sin_family : sa_family_t; sin_port : in_port_t; sin_addr : struct_in_addr; sin_zero : POSIX_String (1 .. 8); end record; for struct_sockaddr_in use record sin_family at 0 range 0 .. 15; sin_port at 2 range 0 .. 15; sin_addr at 4 range 0 .. 31; sin_zero at 8 range 0 .. 63; end record; pragma Convention (C_Pass_By_Copy, struct_sockaddr_in); for struct_sockaddr_in'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_sockaddr_in'Size use 128; pragma Warnings (On); type sockaddr_in_ptr is access constant struct_sockaddr_in; pragma Convention (C, sockaddr_in_ptr); type sockaddr_in_var_ptr is access all struct_sockaddr_in; pragma Convention (C, sockaddr_in_var_ptr); -- IP Level ip_opts structure -- type struct_ip_opts is record ip_dst : struct_in_addr; ip_opts : POSIX.Octet_Array (1 .. 40); end record; for struct_ip_opts use record ip_dst at 0 range 0 .. 31; ip_opts at 4 range 0 .. 319; end record; pragma Convention (C_Pass_By_Copy, struct_ip_opts); for struct_ip_opts'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_ip_opts'Size use 352; pragma Warnings (On); type ip_opts_ptr is access constant struct_ip_opts; pragma Convention (C, ip_opts_ptr); type ip_opts_var_ptr is access all struct_ip_opts; pragma Convention (C, ip_opts_var_ptr); -------------------------------- -- link names for functions -- -------------------------------- HAVE_accept : constant Boolean := True; accept_LINKNAME : constant String := "accept"; HAVE_bind : constant Boolean := True; bind_LINKNAME : constant String := "bind"; HAVE_connect : constant Boolean := True; connect_LINKNAME : constant String := "connect"; HAVE_getsockname : constant Boolean := True; getsockname_LINKNAME : constant String := "getsockname"; HAVE_getsockopt : constant Boolean := True; getsockopt_LINKNAME : constant String := "getsockopt"; HAVE_isfdtype : constant Boolean := True; isfdtype_LINKNAME : constant String := "isfdtype"; HAVE_listen : constant Boolean := True; listen_LINKNAME : constant String := "listen"; HAVE_recv : constant Boolean := True; recv_LINKNAME : constant String := "recv"; HAVE_recvfrom : constant Boolean := True; recvfrom_LINKNAME : constant String := "recvfrom"; HAVE_recvmsg : constant Boolean := True; recvmsg_LINKNAME : constant String := "recvmsg"; HAVE_send : constant Boolean := True; send_LINKNAME : constant String := "send"; HAVE_sendto : constant Boolean := True; sendto_LINKNAME : constant String := "sendto"; HAVE_sendmsg : constant Boolean := True; sendmsg_LINKNAME : constant String := "sendmsg"; HAVE_setsockopt : constant Boolean := True; setsockopt_LINKNAME : constant String := "setsockopt"; HAVE_shutdown : constant Boolean := True; shutdown_LINKNAME : constant String := "shutdown"; HAVE_socket : constant Boolean := True; socket_LINKNAME : constant String := "socket"; HAVE_sockatmark : constant Boolean := True; sockatmark_LINKNAME : constant String := "sockatmark"; HAVE_socketpair : constant Boolean := True; socketpair_LINKNAME : constant String := "socketpair"; end Sockets; package XTI is ---------------------- -- XTI structures -- ---------------------- -- netbuf structure -- -- *** MISSING: netbuf *** -- type struct_netbuf is record maxlen : unsigned_int; len : unsigned_int; buf : char_ptr; end record; for struct_netbuf use record maxlen at 0 range 0 .. 31; len at 4 range 0 .. 31; buf at 8 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_netbuf); for struct_netbuf'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_netbuf'Size use 96; pragma Warnings (On); type netbuf_ptr is access constant struct_netbuf; pragma Convention (C, netbuf_ptr); type netbuf_var_ptr is access all struct_netbuf; pragma Convention (C, netbuf_var_ptr); -- t_info structure -- -- *** MISSING: t_info *** -- type struct_t_info is record addr : long; options : long; tsdu : long; etsdu : long; connect : long; discon : long; servtype : long; flags : long; end record; for struct_t_info use record addr at 0 range 0 .. 31; options at 4 range 0 .. 31; tsdu at 8 range 0 .. 31; etsdu at 12 range 0 .. 31; connect at 16 range 0 .. 31; discon at 20 range 0 .. 31; servtype at 24 range 0 .. 31; flags at 28 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_info); for struct_t_info'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_info'Size use 256; pragma Warnings (On); type t_info_ptr is access constant struct_t_info; pragma Convention (C, t_info_ptr); type t_info_var_ptr is access all struct_t_info; pragma Convention (C, t_info_var_ptr); -- t_opthdr structure -- -- *** MISSING: t_opthdr *** -- type struct_t_opthdr is record len : unsigned_long; level : unsigned_long; name : unsigned_long; status : unsigned_long; end record; for struct_t_opthdr use record len at 0 range 0 .. 31; level at 4 range 0 .. 31; name at 8 range 0 .. 31; status at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_opthdr); for struct_t_opthdr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_opthdr'Size use 128; pragma Warnings (On); type t_opthdr_ptr is access constant struct_t_opthdr; pragma Convention (C, t_opthdr_ptr); type t_opthdr_var_ptr is access all struct_t_opthdr; pragma Convention (C, t_opthdr_var_ptr); -- t_bind structure -- -- *** MISSING: t_bind *** -- type struct_t_bind is record addr : struct_netbuf; qlen : unsigned; end record; for struct_t_bind use record addr at 0 range 0 .. 95; qlen at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_bind); for struct_t_bind'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_bind'Size use 128; pragma Warnings (On); type t_bind_ptr is access constant struct_t_bind; pragma Convention (C, t_bind_ptr); type t_bind_var_ptr is access all struct_t_bind; pragma Convention (C, t_bind_var_ptr); -- t_optmgmt structure -- -- *** MISSING: t_optmgmt *** -- type struct_t_optmgmt is record opt : struct_netbuf; flags : long; end record; for struct_t_optmgmt use record opt at 0 range 0 .. 95; flags at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_optmgmt); for struct_t_optmgmt'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_optmgmt'Size use 128; pragma Warnings (On); type t_optmgmt_ptr is access constant struct_t_optmgmt; pragma Convention (C, t_optmgmt_ptr); type t_optmgmt_var_ptr is access all struct_t_optmgmt; pragma Convention (C, t_optmgmt_var_ptr); -- t_discon structure -- -- *** MISSING: t_discon *** -- type struct_t_discon is record udata : struct_netbuf; reason : int; sequence : int; end record; for struct_t_discon use record udata at 0 range 0 .. 95; reason at 12 range 0 .. 31; sequence at 16 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_discon); for struct_t_discon'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_discon'Size use 160; pragma Warnings (On); type t_discon_ptr is access constant struct_t_discon; pragma Convention (C, t_discon_ptr); type t_discon_var_ptr is access all struct_t_discon; pragma Convention (C, t_discon_var_ptr); -- t_call structure -- -- *** MISSING: t_call *** -- type struct_t_call is record addr : struct_netbuf; opt : struct_netbuf; udata : struct_netbuf; sequence : int; end record; for struct_t_call use record addr at 0 range 0 .. 95; opt at 12 range 0 .. 95; udata at 24 range 0 .. 95; sequence at 36 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_call); for struct_t_call'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_call'Size use 320; pragma Warnings (On); type t_call_ptr is access constant struct_t_call; pragma Convention (C, t_call_ptr); type t_call_var_ptr is access all struct_t_call; pragma Convention (C, t_call_var_ptr); -- t_unitdata structure -- -- *** MISSING: t_unitdata *** -- type struct_t_unitdata is record addr : struct_netbuf; opt : struct_netbuf; udata : struct_netbuf; end record; for struct_t_unitdata use record addr at 0 range 0 .. 95; opt at 12 range 0 .. 95; udata at 24 range 0 .. 95; end record; pragma Convention (C_Pass_By_Copy, struct_t_unitdata); for struct_t_unitdata'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_unitdata'Size use 288; pragma Warnings (On); type t_unitdata_ptr is access constant struct_t_unitdata; pragma Convention (C, t_unitdata_ptr); type t_unitdata_var_ptr is access all struct_t_unitdata; pragma Convention (C, t_unitdata_var_ptr); -- t_uderr structure -- -- *** MISSING: t_uderr *** -- type struct_t_uderr is record addr : struct_netbuf; opt : struct_netbuf; error : long; end record; for struct_t_uderr use record addr at 0 range 0 .. 95; opt at 12 range 0 .. 95; error at 24 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_uderr); for struct_t_uderr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_uderr'Size use 224; pragma Warnings (On); type t_uderr_ptr is access constant struct_t_uderr; pragma Convention (C, t_uderr_ptr); type t_uderr_var_ptr is access all struct_t_uderr; pragma Convention (C, t_uderr_var_ptr); -- t_iovec structure -- -- *** MISSING: t_iovec *** -- type struct_t_iovec is record iov_base : char_ptr; iov_len : unsigned_int; end record; for struct_t_iovec use record iov_base at 0 range 0 .. 31; iov_len at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_iovec); for struct_t_iovec'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_iovec'Size use 64; pragma Warnings (On); type t_iovec_ptr is access constant struct_t_iovec; pragma Convention (C, t_iovec_ptr); type t_iovec_var_ptr is access all struct_t_iovec; pragma Convention (C, t_iovec_var_ptr); -- t_kpalive structure -- -- *** MISSING: t_kpalive *** -- type struct_t_kpalive is record kp_onoff : long; kp_timeout : long; end record; for struct_t_kpalive use record kp_onoff at 0 range 0 .. 31; kp_timeout at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_kpalive); for struct_t_kpalive'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_kpalive'Size use 64; pragma Warnings (On); type t_kpalive_ptr is access constant struct_t_kpalive; pragma Convention (C, t_kpalive_ptr); type t_kpalive_var_ptr is access all struct_t_kpalive; pragma Convention (C, t_kpalive_var_ptr); -- The following are the events returned from t_look() -- -- *** MISSING: T_LISTEN *** -- T_LISTEN : constant := 0; -- *** MISSING: T_CONNECT *** -- T_CONNECT : constant := 0; -- *** MISSING: T_DATA *** -- T_DATA : constant := 0; -- *** MISSING: T_EXDATA *** -- T_EXDATA : constant := 0; -- *** MISSING: T_DISCONNECT *** -- T_DISCONNECT : constant := 0; -- *** MISSING: T_UDERR *** -- T_UDERR : constant := 0; -- *** MISSING: T_ORDREL *** -- T_ORDREL : constant := 0; -- *** MISSING: T_GODATA *** -- T_GODATA : constant := 0; -- *** MISSING: T_GOEXDATA *** -- T_GOEXDATA : constant := 0; -- *** MISSING: T_EVENTS *** -- T_EVENTS : constant := 0; -- *** MISSING: T_MORE *** -- T_MORE : constant := 0; -- *** MISSING: T_EXPEDITED *** -- T_EXPEDITED : constant := 0; -- *** MISSING: T_PUSH *** -- T_PUSH : constant := 0; -- *** MISSING: T_NEGOTIATE *** -- T_NEGOTIATE : constant := 0; -- *** MISSING: T_CHECK *** -- T_CHECK : constant := 0; -- *** MISSING: T_DEFAULT *** -- T_DEFAULT : constant := 0; -- *** MISSING: T_SUCCESS *** -- T_SUCCESS : constant := 0; -- *** MISSING: T_FAILURE *** -- T_FAILURE : constant := 0; -- *** MISSING: T_CURRENT *** -- T_CURRENT : constant := 0; -- *** MISSING: T_PARTSUCCESS *** -- T_PARTSUCCESS : constant := 0; -- *** MISSING: T_READONLY *** -- T_READONLY : constant := 0; -- *** MISSING: T_NOTSUPPORT *** -- T_NOTSUPPORT : constant := 0; -- *** MISSING: T_RAW *** -- T_RAW : constant := 0; -- Service types defines -- -- *** MISSING: T_COTS *** -- T_COTS : constant := 0; -- *** MISSING: T_COTS_ORD *** -- T_COTS_ORD : constant := 0; -- *** MISSING: T_CLTS *** -- T_CLTS : constant := 0; -- *** MISSING: T_SENDZERO *** -- T_SENDZERO : constant := 0; -- *** MISSING: SENDZERO *** -- SENDZERO : constant := 0; -- *** MISSING: T_XPG4_1 *** -- T_XPG4_1 : constant := 0; -- *** MISSING: XPG4_1 *** -- XPG4_1 : constant := 0; -- *** MISSING: T_BIND *** -- T_BIND : constant := 0; -- *** MISSING: T_OPTMGMT *** -- T_OPTMGMT : constant := 0; -- *** MISSING: T_CALL *** -- T_CALL : constant := 0; -- *** MISSING: T_DIS *** -- T_DIS : constant := 0; -- *** MISSING: T_UNITDATA *** -- T_UNITDATA : constant := 0; -- *** MISSING: T_UDERROR *** -- T_UDERROR : constant := 0; -- *** MISSING: T_INFO *** -- T_INFO : constant := 0; -- *** MISSING: T_KUNITDATA *** -- T_KUNITDATA : constant := 0; -- *** MISSING: T_ADDR *** -- T_ADDR : constant := 0; -- *** MISSING: T_OPT *** -- T_OPT : constant := 0; -- *** MISSING: T_UDATA *** -- T_UDATA : constant := 0; -- *** MISSING: T_ALL *** -- T_ALL : constant := 0; -- *** MISSING: T_UNINIT *** -- T_UNINIT : constant := 0; -- *** MISSING: T_UNBND *** -- T_UNBND : constant := 0; -- *** MISSING: T_IDLE *** -- T_IDLE : constant := 0; -- *** MISSING: T_OUTCON *** -- T_OUTCON : constant := 0; -- *** MISSING: T_INCON *** -- T_INCON : constant := 0; -- *** MISSING: T_DATAXFER *** -- T_DATAXFER : constant := 0; -- *** MISSING: T_OUTREL *** -- T_OUTREL : constant := 0; -- *** MISSING: T_INREL *** -- T_INREL : constant := 0; -- *** MISSING: T_YES *** -- T_YES : constant := 0; -- *** MISSING: T_NO *** -- T_NO : constant := 0; -- *** MISSING: T_UNUSED *** -- T_UNUSED : constant := 0; -- *** MISSING: T_NULL *** -- T_NULL : constant := 0; -- *** MISSING: T_ABSREQ *** -- T_ABSREQ : constant := 0; -- *** MISSING: T_INFINITE *** -- T_INFINITE : constant := 0; -- *** MISSING: T_INVALID *** -- T_INVALID : constant := 0; -- XTI-level Options -- -- *** MISSING: XTI_GENERIC *** -- XTI_GENERIC : constant := 0; -- *** MISSING: XTI_DEBUG *** -- XTI_DEBUG : constant := 0; -- *** MISSING: XTI_LINGER *** -- XTI_LINGER : constant := 0; -- *** MISSING: XTI_RCVBUF *** -- XTI_RCVBUF : constant := 0; -- *** MISSING: XTI_RCVLOWAT *** -- XTI_RCVLOWAT : constant := 0; -- *** MISSING: XTI_SNDBUF *** -- XTI_SNDBUF : constant := 0; -- *** MISSING: XTI_SNDLOWAT *** -- XTI_SNDLOWAT : constant := 0; -- t_linger structure -- -- *** MISSING: t_linger *** -- type struct_t_linger is record l_onoff : long; l_linger : long; end record; for struct_t_linger use record l_onoff at 0 range 0 .. 31; l_linger at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_linger); for struct_t_linger'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_linger'Size use 64; pragma Warnings (On); type t_linger_ptr is access constant struct_t_linger; pragma Convention (C, t_linger_ptr); type t_linger_var_ptr is access all struct_t_linger; pragma Convention (C, t_linger_var_ptr); -- General definitions for option management -- -- *** MISSING: T_UNSPEC *** -- T_UNSPEC : constant := 0; -- *** MISSING: T_ALLOPT *** -- T_ALLOPT : constant := 0; function c_T_ALIGN (p : char_ptr) return int; pragma Import (C, c_T_ALIGN, "c_T_ALIGN"); -- TCP Level and Options -- -- *** MISSING: INET_TCP *** -- INET_TCP : constant := 0; TCP_NODELAY : constant := 1; TCP_MAXSEG : constant := 2; -- *** MISSING: TCP_KEEPALIVE *** -- TCP_KEEPALIVE : constant := 0; -- *** MISSING: T_GARBAGE *** -- T_GARBAGE : constant := 0; -- UDP Level and Options -- -- *** MISSING: INET_UDP *** -- INET_UDP : constant := 0; -- *** MISSING: UDP_CHECKSUM *** -- UDP_CHECKSUM : constant := 0; -- IP Level and Options -- -- *** MISSING: INET_IP *** -- INET_IP : constant := 0; IP_OPTIONS : constant := 4; IP_TOS : constant := 1; IP_TTL : constant := 2; -- *** MISSING: IP_REUSEADDR *** -- IP_REUSEADDR : constant := 0; -- *** MISSING: IP_DONTROUTE *** -- IP_DONTROUTE : constant := 0; -- *** MISSING: IP_BROADCAST *** -- IP_BROADCAST : constant := 0; -- IP_TOS precedence levels -- -- *** MISSING: T_ROUTINE *** -- T_ROUTINE : constant := 0; -- *** MISSING: T_PRIORITY *** -- T_PRIORITY : constant := 0; -- *** MISSING: T_IMMEDIATE *** -- T_IMMEDIATE : constant := 0; -- *** MISSING: T_FLASH *** -- T_FLASH : constant := 0; -- *** MISSING: T_OVERRIDEFLASH *** -- T_OVERRIDEFLASH : constant := 0; -- *** MISSING: T_CRITIC_ECP *** -- T_CRITIC_ECP : constant := 0; -- *** MISSING: T_INETCONTROL *** -- T_INETCONTROL : constant := 0; -- *** MISSING: T_NETCONTROL *** -- T_NETCONTROL : constant := 0; -- IP_TOS type of service -- -- *** MISSING: T_NOTOS *** -- T_NOTOS : constant := 0; -- *** MISSING: T_LDELAY *** -- T_LDELAY : constant := 0; -- *** MISSING: T_HITHRPT *** -- T_HITHRPT : constant := 0; -- *** MISSING: T_HIREL *** -- T_HIREL : constant := 0; -------------------------------- -- link names for functions -- -------------------------------- -- *** MISSING: function t_accept *** -- HAVE_t_accept : constant Boolean := False; t_accept_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_alloc *** -- HAVE_t_alloc : constant Boolean := False; t_alloc_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_bind *** -- HAVE_t_bind : constant Boolean := False; t_bind_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_blocking *** -- HAVE_t_blocking : constant Boolean := False; t_blocking_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_close *** -- HAVE_t_close : constant Boolean := False; t_close_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_connect *** -- HAVE_t_connect : constant Boolean := False; t_connect_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_error *** -- HAVE_t_error : constant Boolean := False; t_error_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_free *** -- HAVE_t_free : constant Boolean := False; t_free_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_getinfo *** -- HAVE_t_getinfo : constant Boolean := False; t_getinfo_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_getprotaddr *** -- HAVE_t_getprotaddr : constant Boolean := False; t_getprotaddr_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_getstate *** -- HAVE_t_getstate : constant Boolean := False; t_getstate_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_listen *** -- HAVE_t_listen : constant Boolean := False; t_listen_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_look *** -- HAVE_t_look : constant Boolean := False; t_look_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_nonblocking *** -- HAVE_t_nonblocking : constant Boolean := False; t_nonblocking_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_open *** -- HAVE_t_open : constant Boolean := False; t_open_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_optmgmt *** -- HAVE_t_optmgmt : constant Boolean := False; t_optmgmt_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcv *** -- HAVE_t_rcv : constant Boolean := False; t_rcv_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvconnect *** -- HAVE_t_rcvconnect : constant Boolean := False; t_rcvconnect_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvdis *** -- HAVE_t_rcvdis : constant Boolean := False; t_rcvdis_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvrel *** -- HAVE_t_rcvrel : constant Boolean := False; t_rcvrel_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvreldata *** -- HAVE_t_rcvreldata : constant Boolean := False; t_rcvreldata_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvudata *** -- HAVE_t_rcvudata : constant Boolean := False; t_rcvudata_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvuderr *** -- HAVE_t_rcvuderr : constant Boolean := False; t_rcvuderr_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvv *** -- HAVE_t_rcvv : constant Boolean := False; t_rcvv_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvvudata *** -- HAVE_t_rcvvudata : constant Boolean := False; t_rcvvudata_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_snd *** -- HAVE_t_snd : constant Boolean := False; t_snd_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_snddis *** -- HAVE_t_snddis : constant Boolean := False; t_snddis_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_sndudata *** -- HAVE_t_sndudata : constant Boolean := False; t_sndudata_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_sndrel *** -- HAVE_t_sndrel : constant Boolean := False; t_sndrel_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_sndreldata *** -- HAVE_t_sndreldata : constant Boolean := False; t_sndreldata_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_sndv *** -- HAVE_t_sndv : constant Boolean := False; t_sndv_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_sndvudata *** -- HAVE_t_sndvudata : constant Boolean := False; t_sndvudata_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_strerror *** -- HAVE_t_strerror : constant Boolean := False; t_strerror_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_sync *** -- HAVE_t_sync : constant Boolean := False; t_sync_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_unbind *** -- HAVE_t_unbind : constant Boolean := False; t_unbind_LINKNAME : constant String := "nosys_neg_one"; end XTI; package Netinet is ------------------------- -- From netinet/in.h -- ------------------------- IPPROTO_IP : constant := 0; IPPROTO_ICMP : constant := 1; IPPROTO_TCP : constant := 6; IPPROTO_UDP : constant := 17; IPPROTO_RAW : constant := 255; IP_OPTIONS : constant := 4; IP_HDRINCL : constant := 3; IP_TOS : constant := 1; IP_TTL : constant := 2; -- *** MISSING: IP_RECVDSTADDR *** -- IP_RECVDSTADDR : constant := 0; INADDR_NONE : constant := 4294967295; INADDR_ANY : constant := 0; INADDR_BROADCAST : constant := 4294967295; INADDR_LOOPBACK : constant := 2130706433; INADDR_UNSPEC_GROUP : constant := 3758096384; INADDR_ALLHOSTS_GROUP : constant := 3758096385; INADDR_MAX_LOCAL_GROUP : constant := 3758096639; HAVE_inet_addr : constant Boolean := True; inet_addr_LINKNAME : constant String := "inet_addr"; HAVE_inet_makeaddr : constant Boolean := True; inet_makeaddr_LINKNAME : constant String := "inet_makeaddr"; HAVE_inet_network : constant Boolean := True; inet_network_LINKNAME : constant String := "inet_network"; HAVE_inet_lnaof : constant Boolean := True; inet_lnaof_LINKNAME : constant String := "inet_lnaof"; HAVE_inet_netof : constant Boolean := True; inet_netof_LINKNAME : constant String := "inet_netof"; HAVE_inet_ntoa : constant Boolean := True; inet_ntoa_LINKNAME : constant String := "inet_ntoa"; -------------------------- -- From netinet/tcp.h -- -------------------------- TCP_NODELAY : constant := 1; TCP_MAXSEG : constant := 2; -- *** MISSING: TCP_KEEPALIVE *** -- TCP_KEEPALIVE : constant := 0; -- *** MISSING: TCP_MAXRXT *** -- TCP_MAXRXT : constant := 0; -- *** MISSING: TCP_STDURG *** -- TCP_STDURG : constant := 0; ------------------------- -- From netinet/ip.h -- ------------------------- IPTOS_LOWDELAY : constant := 16; IPTOS_THROUGHPUT : constant := 8; IPTOS_RELIABILITY : constant := 4; end Netinet; package NetDB is use Sockets; type struct_netent is record n_name : char_ptr; n_aliases : char_ptr_ptr; n_addrtype : int; n_net : in_addr_t; end record; for struct_netent use record n_name at 0 range 0 .. 31; n_aliases at 4 range 0 .. 31; n_addrtype at 8 range 0 .. 31; n_net at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_netent); for struct_netent'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_netent'Size use 128; pragma Warnings (On); type netent_ptr is access constant struct_netent; pragma Convention (C, netent_ptr); type netent_var_ptr is access all struct_netent; pragma Convention (C, netent_var_ptr); -- protocol database entry -- type struct_protoent is record p_name : char_ptr; p_aliases : char_ptr_ptr; p_proto : int; end record; for struct_protoent use record p_name at 0 range 0 .. 31; p_aliases at 4 range 0 .. 31; p_proto at 8 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_protoent); for struct_protoent'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_protoent'Size use 96; pragma Warnings (On); type protoent_ptr is access constant struct_protoent; pragma Convention (C, protoent_ptr); type protoent_var_ptr is access all struct_protoent; pragma Convention (C, protoent_var_ptr); -- local socket address -- HAVE_endhostent : constant Boolean := True; endhostent_LINKNAME : constant String := "endhostent"; HAVE_endnetent : constant Boolean := True; endnetent_LINKNAME : constant String := "endnetent"; HAVE_endprotoent : constant Boolean := True; endprotoent_LINKNAME : constant String := "endprotoent"; HAVE_endservent : constant Boolean := True; endservent_LINKNAME : constant String := "endservent"; HAVE_getaddrinfo : constant Boolean := True; getaddrinfo_LINKNAME : constant String := "getaddrinfo"; HAVE_freeaddrinfo : constant Boolean := True; freeaddrinfo_LINKNAME : constant String := "freeaddrinfo"; HAVE_getnameinfo : constant Boolean := True; getnameinfo_LINKNAME : constant String := "getnameinfo"; HAVE_gethostbyaddr : constant Boolean := True; gethostbyaddr_LINKNAME : constant String := "gethostbyaddr"; HAVE_gethostbyaddr_r : constant Boolean := True; gethostbyaddr_r_LINKNAME : constant String := "gethostbyaddr_r"; HAVE_gethostbyname : constant Boolean := True; gethostbyname_LINKNAME : constant String := "gethostbyname"; HAVE_gethostbyname_r : constant Boolean := True; gethostbyname_r_LINKNAME : constant String := "gethostbyname_r"; HAVE_gethostname : constant Boolean := True; gethostname_LINKNAME : constant String := "gethostname"; HAVE_getnetbyaddr : constant Boolean := True; getnetbyaddr_LINKNAME : constant String := "getnetbyaddr"; HAVE_getnetbyaddr_r : constant Boolean := True; getnetbyaddr_r_LINKNAME : constant String := "getnetbyaddr_r"; HAVE_getnetbyname : constant Boolean := True; getnetbyname_LINKNAME : constant String := "getnetbyname"; HAVE_getnetbyname_r : constant Boolean := True; getnetbyname_r_LINKNAME : constant String := "getnetbyname_r"; HAVE_getpeername : constant Boolean := True; getpeername_LINKNAME : constant String := "getpeername"; HAVE_getprotobyname : constant Boolean := True; getprotobyname_LINKNAME : constant String := "getprotobyname"; HAVE_getprotobyname_r : constant Boolean := True; getprotobyname_r_LINKNAME : constant String := "getprotobyname_r"; HAVE_getprotobynumber : constant Boolean := True; getprotobynumber_LINKNAME : constant String := "getprotobynumber"; HAVE_getprotobynumber_r : constant Boolean := True; getprotobynumber_r_LINKNAME : constant String := "getprotobynumber_r"; HAVE_getservbyname : constant Boolean := True; getservbyname_LINKNAME : constant String := "getservbyname"; HAVE_getservbyname_r : constant Boolean := True; getservbyname_r_LINKNAME : constant String := "getservbyname_r"; HAVE_getservbyport : constant Boolean := True; getservbyport_LINKNAME : constant String := "getservbyport"; HAVE_getservbyport_r : constant Boolean := True; getservbyport_r_LINKNAME : constant String := "getservbyport_r"; HAVE_sethostent : constant Boolean := True; sethostent_LINKNAME : constant String := "sethostent"; HAVE_setnetent : constant Boolean := True; setnetent_LINKNAME : constant String := "setnetent"; HAVE_setprotoent : constant Boolean := True; setprotoent_LINKNAME : constant String := "setprotoent"; HAVE_setservent : constant Boolean := True; setservent_LINKNAME : constant String := "setservent"; end NetDB; -- pollfd structure -- type struct_pollfd is record fd : int; events : short; revents : short; end record; for struct_pollfd use record fd at 0 range 0 .. 31; events at 4 range 0 .. 15; revents at 6 range 0 .. 15; end record; pragma Convention (C_Pass_By_Copy, struct_pollfd); for struct_pollfd'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_pollfd'Size use 64; pragma Warnings (On); type pollfd_ptr is access constant struct_pollfd; pragma Convention (C, pollfd_ptr); type pollfd_var_ptr is access all struct_pollfd; pragma Convention (C, pollfd_var_ptr); type fd_mask_array is array (Integer range <>) of unsigned_int; -- fd_set structure -- type fd_set is array (1 .. 32) of int; for fd_set'Alignment use ALIGNMENT; for fd_set'Size use 1024; type fd_set_ptr is access constant fd_set; pragma Convention (C, fd_set_ptr); type fd_set_var_ptr is access all fd_set; pragma Convention (C, fd_set_var_ptr); FD_SETSIZE : constant := 1024; -- *** MISSING: INFTIM *** -- INFTIM : constant := 0; POLLIN : constant := 1; POLLRDNORM : constant := 64; POLLRDBAND : constant := 128; POLLPRI : constant := 2; POLLWRNORM : constant := 256; POLLWRBAND : constant := 512; POLLERR : constant := 8; POLLNVAL : constant := 32; HAVE_poll : constant Boolean := True; poll_LINKNAME : constant String := "poll"; HAVE_select : constant Boolean := True; select_LINKNAME : constant String := "select"; end POSIX.C; florist-gpl-2017-src/gensrc.elinos/posix-implementation.adb0000644000076700001450000003453113106553472023431 0ustar gnatmailgnatpragma Source_Reference (1, "libsrc/posix-implementation.gpb"); ------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . I M P L E M E N T A T I O N -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with Ada.Exceptions, --! # if HAVE_Safe_Errno then --! # else --! POSIX.Error_Codes, --! # end if; System.Interrupt_Management.Operations, GNAT.Task_Lock, System.Soft_Links; package body POSIX.Implementation is use POSIX.C; package SIM renames System.Interrupt_Management; package SIMO renames System.Interrupt_Management.Operations; --! # if HAVE_Safe_Errno then procedure Set_Ada_Error_Code (Error : Error_Code) is begin Store_Errno (Error); end Set_Ada_Error_Code; function Get_Ada_Error_Code return Error_Code is begin return Fetch_Errno; end Get_Ada_Error_Code; --! # else --! --! procedure Set_Ada_Error_Code (Error : Error_Code) is --! begin --! POSIX.Error_Codes.Set_Value (Error); --! end Set_Ada_Error_Code; --! --! function Get_Ada_Error_Code return Error_Code is --! begin --! return POSIX.Error_Codes.Value; --! end Get_Ada_Error_Code; --! --! # end if; -- .... It would be nice if we had a way to check whether we -- are in a critical section, at the points (below) where we are -- about to raise an exception. These routines should never be -- called from inside a critical section, but that is an easy -- mistake to make. ------------------------------ -- Begin_Critical_Section -- ------------------------------ procedure Begin_Critical_Section is begin GNAT.Task_Lock.Lock; end Begin_Critical_Section; ---------------------------- -- End_Critical_Section -- ---------------------------- procedure End_Critical_Section is begin GNAT.Task_Lock.Unlock; end End_Critical_Section; ---------------------- -- Defer_Abortion -- ---------------------- procedure Defer_Abortion is begin System.Soft_Links.Abort_Defer.all; end Defer_Abortion; ------------------------ -- Undefer_Abortion -- ------------------------ procedure Undefer_Abortion is begin System.Soft_Links.Abort_Undefer.all; end Undefer_Abortion; ------------------------- -- Raise_POSIX_Error -- ------------------------- procedure Raise_POSIX_Error (Error : Error_Code := No_Error) is Tmp : Error_Code := Error; begin -- .... see note on critical sections above if Error = No_Error then Tmp := Fetch_Errno; end if; Set_Ada_Error_Code (Tmp); Ada.Exceptions.Raise_Exception (POSIX_Error'Identity, Image (Tmp)); end Raise_POSIX_Error; ------------- -- Check -- ------------- procedure Check (Condition : Boolean; Error : Error_Code; Old_Mask : Signal_Mask_Access := null) is begin -- .... see note on critical sections above if not Condition then if Old_Mask /= null then Restore_Signals (Old_Mask); end if; Raise_POSIX_Error (Error); end if; end Check; procedure Check (Result : int; Old_Mask : Signal_Mask_Access := null) is begin -- .... see note on critical sections above if Result = -1 then if Old_Mask /= null then Restore_Signals (Old_Mask); end if; Raise_POSIX_Error (Fetch_Errno); end if; end Check; function Check (Result : int; Old_Mask : Signal_Mask_Access := null) return int is begin -- .... see note on critical sections above if Result = -1 then if Old_Mask /= null then Restore_Signals (Old_Mask); end if; Raise_POSIX_Error (Fetch_Errno); end if; return Result; end Check; -- ....is there a better work-around???? -- Provenzano's threads seem to -- return nonstandard negative values for some calls, -- like "close". procedure Check_NNeg (Result : int) is begin -- .... see note on critical sections above if Result < 0 then Raise_POSIX_Error (Fetch_Errno); end if; end Check_NNeg; -- ....is there a better work-around???? -- Provenzano's threads seem to -- return nonstandard negative values for some calls, -- like "close". function Check_NNeg (Result : int) return int is begin -- .... see note on critical sections above. if Result < 0 then Raise_POSIX_Error (Fetch_Errno); end if; return Result; end Check_NNeg; procedure Check_NZ (Result : int) is begin -- .... see note on critical sections above. if Result /= 0 then Raise_POSIX_Error (Error_Code (Result)); end if; end Check_NZ; ------------------- -- Form_String -- ------------------- function strlen (str : char_ptr) return size_t; pragma Import (C, strlen, "strlen"); function Form_String (Str : char_ptr) return String is begin if Str = null then return ""; end if; declare subtype Substring is String (1 .. Integer (strlen (Str))); type Substring_Ptr is access Substring; pragma Warnings (Off); function char_ptr_to_pssptr is new Unchecked_Conversion (char_ptr, Substring_Ptr); pragma Warnings (On); begin return char_ptr_to_pssptr (Str).all; end; end Form_String; --------------------------- -- Trim_Leading_Blanks -- --------------------------- function Trim_Leading_Blank (S : String) return String is begin if S (S'First) /= ' ' then return S; end if; return S (S'First + 1 .. S'Last); end Trim_Leading_Blank; -------------------- -- Nulterminate -- -------------------- type Big_POSIX_String_Ptr is access all POSIX_String (Positive'Range); function From_Address is new Unchecked_Conversion (System.Address, Big_POSIX_String_Ptr); procedure Nulterminate (To : out POSIX_String; From : String) is L : constant Positive := From'Length; begin if To'Length <= L then raise Constraint_Error; end if; To (1 .. L) := From_Address (From'Address) (1 .. L); To (L + 1) := NUL; end Nulterminate; ----------------------- -- Not_Implemented -- ----------------------- function Not_Implemented_Neg_One return int is begin Store_Errno (ENOSYS); return -1; end Not_Implemented_Neg_One; function Not_Implemented_Direct return int is begin return ENOSYS; end Not_Implemented_Direct; function Not_Supported_Neg_One return int is begin Store_Errno (ENOTSUP); return -1; end Not_Supported_Neg_One; function Not_Supported_Direct return int is begin return ENOTSUP; end Not_Supported_Direct; ---------------------- -- Signal Masking -- ---------------------- -- For RTS_Signals we mask all the signals identified as reserved -- by the tasking RTS. However, we leave SIGABRT alone since it is being -- used as the signal for abortion which needs to be invoked for -- POSIX.Signals.Interrupt_Task. Do not mask SIGTRAP either because -- this signal is used by the debugger. -- ...Fix POSIX.5b???? -- It seems we are deviating here from what the standard says, but for -- very good reasons. procedure Mask_Signals (Masking : Signal_Masking; Old_Mask : Signal_Mask_Access) is use type SIM.Interrupt_ID; begin if Masking /= No_Signals then declare New_Mask : aliased Signal_Mask; begin Begin_Critical_Section; SIMO.Get_Interrupt_Mask (New_Mask'Unchecked_Access); SIMO.Copy_Interrupt_Mask (Old_Mask.all, New_Mask); if Masking = RTS_Signals then for J in 1 .. SIM.Interrupt_ID'Last loop if SIM.Reserve (J) and J /= SIGABRT and J /= SIGTRAP then SIMO.Add_To_Interrupt_Mask (New_Mask'Unchecked_Access, J); end if; end loop; else -- All_Signals SIMO.Fill_Interrupt_Mask (New_Mask'Unchecked_Access); end if; SIMO.Set_Interrupt_Mask (New_Mask'Unchecked_Access); End_Critical_Section; end; end if; end Mask_Signals; procedure Restore_Signals (Masking : Signal_Masking; Old_Mask : Signal_Mask_Access) is begin if Masking /= No_Signals then Begin_Critical_Section; SIMO.Set_Interrupt_Mask (Old_Mask); End_Critical_Section; end if; end Restore_Signals; procedure Restore_Signals (Old_Mask : Signal_Mask_Access) is begin Begin_Critical_Section; SIMO.Set_Interrupt_Mask (Old_Mask); End_Critical_Section; end Restore_Signals; ------------------------------------- -- Check_..._And_Restore_Signals -- ------------------------------------- procedure Restore_Signals_And_Raise_POSIX_Error (Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access) is Error : constant Error_Code := Fetch_Errno; begin Restore_Signals (Masked_Signals, Old_Mask); Raise_POSIX_Error (Error); end Restore_Signals_And_Raise_POSIX_Error; procedure Check_NNeg_And_Restore_Signals (Result : int; Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access) is begin if Result < 0 then Restore_Signals_And_Raise_POSIX_Error (Masked_Signals, Old_Mask); else Restore_Signals (Masked_Signals, Old_Mask); end if; end Check_NNeg_And_Restore_Signals; -------------------------- -- To_Struct_Timespec -- -------------------------- function To_Struct_Timespec (D : Duration) return struct_timespec is S : time_t; F : Duration; begin S := time_t (Long_Long_Integer (D)); F := D - Duration (S); -- If F has negative value due to a round-up, adjust for positive F -- value. if F < 0.0 then S := S - 1; F := F + 1.0; end if; return struct_timespec'(tv_sec => S, tv_nsec => long (Long_Long_Integer (F * NS_per_S))); end To_Struct_Timespec; function To_Struct_Timespec (T : Timespec) return struct_timespec is begin return To_Struct_Timespec (To_Duration (T)); end To_Struct_Timespec; ------------------- -- To_Duration -- ------------------- function To_Duration (TS : struct_timespec) return Duration is begin return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / NS_per_S; end To_Duration; ------------------- -- To_Timespec -- ------------------- function To_Timespec (TS : struct_timespec) return Timespec is begin return Timespec' (Val => Duration (TS.tv_sec) + Duration (TS.tv_nsec) / NS_per_S); end To_Timespec; ------------------- -- To_Duration -- ------------------- function To_Duration (TV : struct_timeval) return Duration is begin return Duration (TV.tv_sec) + Duration (TV.tv_usec) / MS_per_S; end To_Duration; ------------------------- -- To_Struct_Timeval -- ------------------------- function To_Struct_Timeval (D : Duration) return struct_timeval is S : time_t; F : Duration; begin S := time_t (Long_Long_Integer (D)); F := D - Duration (S); -- If F has negative value due to a round-up, adjust for positive F -- value. if F < 0.0 then S := S - 1; F := F + 1.0; end if; return struct_timeval'(tv_sec => S, tv_usec => suseconds_t (Long_Long_Integer (F * MS_per_S))); end To_Struct_Timeval; end POSIX.Implementation; florist-gpl-2017-src/gensrc.elinos/posix-options.ads0000644000076700001450000001314013106553472022111 0ustar gnatmailgnat-- DO NOT EDIT THIS FILE. -- It is generated automatically, by program c-posix.c ------------------------------------------------------------------------------ -- -- -- POSIX Ada95 Bindings for Protocol Independent Interfaces (P1003.5c) -- -- -- -- P O S I X . O P T I O N S -- -- -- -- S p e c -- -- -- -- -- -- -- -- This file is a component of FLORIST, an Ada application program -- -- interface for operating system services for use with the GNAT compiler -- -- and the Gnu Ada Runtime Library (GNARL). FLORIST is intended to -- -- conform to the IEEE POSIX Ada standards, 1003.5-1992 and 1003.5b-1993. -- -- It also includes support for Draft 1 of IEEE Project 1003.5c. -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ package POSIX.Options is subtype Asynchronous_IO_Support is Boolean range True .. True; subtype Change_Owner_Restriction is POSIX.Change_Owner_Restriction; subtype Filename_Truncation is POSIX.Filename_Truncation; subtype File_Synchronization_Support is Boolean range True .. True; subtype Job_Control_Support is POSIX.Job_Control_Support; subtype Memory_Mapped_Files_Support is Boolean range True .. True; subtype Memory_Locking_Support is Boolean range True .. True; subtype Memory_Range_Locking_Support is Boolean range True .. True; subtype Memory_Protection_Support is Boolean range True .. True; subtype Message_Queues_Support is Boolean range True .. True; subtype Saved_IDs_Support is POSIX.Saved_IDs_Support; subtype Mutexes_Support is Boolean range True .. True; subtype Prioritized_IO_Support is Boolean range True .. True; subtype Priority_Process_Scheduling_Support is Boolean range True .. True; subtype Priority_Task_Scheduling_Support is Boolean range True .. True; subtype Realtime_Signals_Support is Boolean range True .. True; subtype Semaphores_Support is Boolean range True .. True; subtype Shared_Memory_Objects_Support is Boolean range True .. True; subtype Signal_Entries_Support is Boolean range True .. True; subtype Synchronized_IO_Support is Boolean range True .. True; subtype Mutex_Priority_Ceiling_Support is Boolean range True .. True; subtype Mutex_Priority_Inheritance_Support is Boolean range True .. True; subtype Process_Shared_Support is Boolean range True .. True; subtype Timers_Support is Boolean range True .. True; subtype XTI_DNI_Support is Boolean range False .. True; subtype Internet_Datagram_Support is Boolean range False .. True; subtype Internet_Protocol_Support is Boolean range False .. True; subtype Internet_Stream_Support is Boolean range False .. True; subtype ISO_OSI_Protocol_Support is Boolean range False .. True; subtype OSI_Minimal_Support is Boolean range False .. True; subtype OSI_Connection_Support is Boolean range False .. True; subtype OSI_Connectionless_Support is Boolean range False .. True; subtype Poll_Support is Boolean range False .. True; subtype Select_Support is Boolean range False .. True; subtype Sockets_DNI_Support is Boolean range False .. True; subtype Network_Management_Support is Boolean range False .. True; end POSIX.Options; florist-gpl-2017-src/c-posix-signals.c0000644000076700001450000004557513106553473017222 0ustar gnatmailgnat/*---------------------------------------------------------------------------- -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- -- -- C - P O S I X - S I G N A L S . C -- -- -- -- -- -- Copyright (C) 1998, Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----------------------------------------------------------------------------*/ /* file: c-posix-signals.c ======================= [$Revision: 232963 $] This program generates the file posix-implementation-ok_signals.ads, which is an Ada package specification that defines a list of signals that seem to work correctly with sigwait(). The test is to mask a given signal, then use kill () to send the signal to the current process, then call sigwait () to receive the signal. The observed behavior for some signals is that the process hangs on sigwait, notably for signals whose default action is to ignore the signal or stop the process. In order to allow testing of more than one signal, the program tries to recover if sigwait() hangs. The first attempt was to use alarm() to arrange for another signal to be delivered, if sigwait() did not receive the tested signal within one second. This seemed to have worked for SIGCHLD and SIGCONT, i.e. the signals whose default action is to ignore them. It did not seem to work for SIGSTOP, SITTSTP, SIGTTIN, SIGTTOU, whose default action is to stop the process. In order to recover for these cases, we moved the test of sigwait() into a child process, and arranged for the parent process to send SIGCONT to the child if it stops. This seems to solve the problem. When linking this test don't forget to use "-lpthread", or the appropriate thread library. */ #define _POSIX_C_SIGNALS_C #include "confsrc/pconfig.h" #define _POSIX_C_SOURCE 199506L #define _REENTRANT #include #include #include #include #include #include #include #include #include /* Uncomment the following only for debugging. */ /* #define DEBUG */ int sigs [] = { 0, #ifdef SIG32 SIG32, #endif #ifdef SIGABRT SIGABRT, #endif #ifdef SIGALRM SIGALRM, #endif #ifdef SIGBUS SIGBUS, #endif #ifdef SIGCANCEL SIGCANCEL, #endif #ifdef SIGCHLD SIGCHLD, #endif #ifdef SIGCLD SIGCLD, #endif #ifdef SIGCONT SIGCONT, #endif #ifdef SIGEMT SIGEMT, #endif #ifdef SIGFPE SIGFPE, #endif #ifdef SIGFREEZE SIGFREEZE, #endif #ifdef SIGHUP SIGHUP, #endif #ifdef SIGILL SIGILL, #endif #ifdef SIGINT SIGINT, #endif #ifdef SIGIO SIGIO, #endif #ifdef SIGIOT SIGIOT, #endif #ifdef SIGKILL SIGKILL, #endif #ifdef SIGLOST SIGLOST, #endif #ifdef SIGLWP SIGLWP, #endif #ifdef SIGPIPE SIGPIPE, #endif #ifdef SIGPOLL SIGPOLL, #endif #ifdef SIGPROF SIGPROF, #endif #ifdef SIGQUIT SIGQUIT, #endif #ifdef SIGSEGV SIGSEGV, #endif #ifdef SIGSTKFLT SIGSTKFLT, #endif #ifdef SIGSYS SIGSYS, #endif #ifdef SIGTERM SIGTERM, #endif #ifdef SIGUSR1 SIGUSR1, #endif #ifdef SIGUSR2 SIGUSR2, #endif #ifdef SIGTRAP SIGTRAP, #endif #ifdef SIGSTOP SIGSTOP, #endif #ifdef SIGTHAW SIGTHAW, #endif #ifdef SIGTSTP SIGTSTP, #endif #ifdef SIGTTIN SIGTTIN, #endif #ifdef SIGTTOU SIGTTOU, #endif #ifdef SIGPWR SIGPWR, #endif #ifdef SIGURG SIGURG, #endif #ifdef SIGUNUSED SIGUNUSED, #endif #ifdef SIGVTALRM SIGVTALRM, #endif #ifdef SIGWAITING SIGWAITING, #endif #ifdef SIGWINCH SIGWINCH, #endif #ifdef SIGXCPU SIGXCPU, #endif #ifdef SIGXFSZ SIGXFSZ, #endif 0}; char *signames [] = { "SIGNONE", #ifdef SIG32 "SIG32", #endif #ifdef SIGABRT "SIGABRT", #endif #ifdef SIGALRM "SIGALRM", #endif #ifdef SIGBUS "SIGBUS", #endif #ifdef SIGCANCEL "SIGCANCEL", #endif #ifdef SIGCHLD "SIGCHLD", #endif #ifdef SIGCLD "SIGCLD", #endif #ifdef SIGCONT "SIGCONT", #endif #ifdef SIGEMT "SIGEMT", #endif #ifdef SIGFPE "SIGFPE", #endif #ifdef SIGFREEZE "SIGFREEZE", #endif #ifdef SIGHUP "SIGHUP", #endif #ifdef SIGILL "SIGILL", #endif #ifdef SIGINT "SIGINT", #endif #ifdef SIGIO "SIGIO", #endif #ifdef SIGIOT "SIGIOT", #endif #ifdef SIGKILL "SIGKILL", #endif #ifdef SIGLOST "SIGLOST", #endif #ifdef SIGLWP "SIGLWP", #endif #ifdef SIGPIPE "SIGPIPE", #endif #ifdef SIGPOLL "SIGPOLL", #endif #ifdef SIGPROF "SIGPROF", #endif #ifdef SIGQUIT "SIGQUIT", #endif #ifdef SIGSEGV "SIGSEGV", #endif #ifdef SIGSTKFLT "SIGSTKFLT", #endif #ifdef SIGSYS "SIGSYS", #endif #ifdef SIGTERM "SIGTERM", #endif #ifdef SIGUSR1 "SIGUSR1", #endif #ifdef SIGUSR2 "SIGUSR2", #endif #ifdef SIGTRAP "SIGTRAP", #endif #ifdef SIGSTOP "SIGSTOP", #endif #ifdef SIGTHAW "SIGTHAW", #endif #ifdef SIGTSTP "SIGTSTP", #endif #ifdef SIGTTIN "SIGTTIN", #endif #ifdef SIGTTOU "SIGTTOU", #endif #ifdef SIGPWR "SIGPWR", #endif #ifdef SIGURG "SIGURG", #endif #ifdef SIGUNUSED "SIGUNUSED", #endif #ifdef SIGVTALRM "SIGVTALRM", #endif #ifdef SIGWAITING "SIGWAITING", #endif #ifdef SIGWINCH "SIGWINCH", #endif #ifdef SIGXCPU "SIGXCPU", #endif #ifdef SIGXFSZ "SIGXFSZ", #endif "SIGNONE"}; int namedsigs = sizeof (sigs) / sizeof (int); int nsigs; int *oksigs; int *oksigs_nodefault; int *oksigs_stop; void comment (char const *msg) { #ifdef DEBUG fprintf (stderr, "%s\n", msg); fflush (stderr); #endif } void handler (int sig) { if (sig == SIGALRM) { comment ("==> in handler for SIGALRM"); } else { comment ("==> in handler: unexpected signal"); exit (-1); } } void handler_parent (int sig) { if (sig == SIGALRM) { comment ("==> PARENT: in handler for SIGALRM"); } else { comment ("==> PARENT: in handler: unexpected signal"); kill (0, SIGKILL); exit (-1); } } void print_package (int *oksigs, int *oksigs_nodefault, int *oksigs_stop) { int sig; FILE *fp; fprintf (stderr,"creating package POSIX.Implementation.OK_Signals\n"); if (! (fp = fopen (GENDIR "/posix-implementation-ok_signals.ads", "w"))) { perror ("posix-implemenation-ok_signals.ads"); exit (-1); } fprintf (fp, "package POSIX.Implementation.OK_Signals is\n"); fprintf (fp, "\n"); fprintf (fp, " -- OK (Sig) = True iff we can use Sig" " with sigwait ().\n\n"); fprintf (fp, " OK : constant array (0 .. %d) of Boolean :=\n", nsigs - 1); fprintf (fp, " ("); for (sig = 0; sig < nsigs; sig++) { if (oksigs_nodefault[sig] == 1) fprintf (fp, " True"); else fprintf (fp, "False"); if (sig == nsigs - 1) fprintf (fp, ");\n"); else if (sig % 10 == 9) fprintf (fp, ",\n "); else fprintf (fp, ", "); } fprintf (fp, "\n"); fprintf (fp, " -- Default_Is_Ignore (Sig) = True iff we need to" " override the default\n"); fprintf (fp, " -- treatment of Sig with a do-nothing handler" " before we try to\n"); fprintf (fp, " -- use sigwait() with it.\n\n"); fprintf (fp, " Default_Is_Ignore : constant array" " (0 .. %d) of Boolean :=\n", nsigs - 1); fprintf (fp, " ("); for (sig = 0; sig < nsigs; sig++) { if ((oksigs[sig] != 1) && (oksigs_nodefault[sig] == 1)) fprintf (fp, " True"); else fprintf (fp, "False"); if (sig == nsigs - 1) fprintf (fp, ");\n"); else if (sig % 10 == 9) fprintf (fp, ",\n "); else fprintf (fp, ", "); } fprintf (fp, "\n -- Default_Is_Stop (Sig) = True iff the default" " action of Sig\n -- is to stop the process.\n\n"); fprintf (fp, " Default_Is_Stop : constant array (0 .. %d)" " of Boolean :=\n", nsigs - 1); fprintf (fp, " ("); for (sig = 0; sig < nsigs; sig++) { if (oksigs_stop[sig] == 1) fprintf (fp, " True"); else fprintf (fp, "False"); if (sig == nsigs - 1) fprintf (fp, ");\n"); else if (sig % 10 == 9) fprintf (fp, ",\n "); else fprintf (fp, ", "); } fprintf (fp, "\nend POSIX.Implementation.OK_Signals;\n"); fclose (fp); } int guess_nsigs () { /* Try to find out the range of valid signals. We have not yet discovered a portable C way of doing this. We assume the range starts at 0 and is continuous up to some limit. We need this becuase we want to represent sets of signals as Boolean arrays. We considered using sigset_t directly, and would have liked to do so, but had two problems: (1) sigset_t apparently allows the use of dynamically allocated memory (2) we could not figure out how to check for signal validity; in particular, we needed a way to check for whether a given signal is reserved by the Ada runtime system. */ #if defined(__APPLE__) # define BADSIG (0) #else # define BADSIG (-1) #endif sigset_t set; int sig; int result; int last_good = -1; int first_bad = -1; sigfillset (&set); for (sig = 0; sig < 1024; sig++) { result = sigismember (&set, sig); if (result == 1) { last_good = sig; } else if ((result == BADSIG) && (first_bad == -1)) { if (sig == 0) { fprintf (stderr, "WARNING: C library problem? " "sigfillset does not include zero\n"); } else first_bad = sig; } } if (last_good == 1023) fprintf (stderr, "WARNING: signal range estimate probably too small\n"); if (first_bad < last_good) { fprintf (stderr, "WARNING: signal range estimate may be invalid\n"); last_good = first_bad - 1; } #if defined(__APPLE__) /* On Darwin, the above mechanism fails to make a reasonable guess as to the number of available signals. In the test loop sigismember returns true for every value of sig, including zero, and no first_bad is ever set. For now, hard code a reasonable value. */ return 32; #else return last_good + 1; #endif } void parent_process(pid_t child, int *oksigs, int sig) { /* Monitor the child process until it terminates. If the child process stops, wake it up. If the child process dies via signal, restart it and tell it to skip the last signal it was trying. */ pid_t ret; int status; struct sigaction act; act.sa_flags = 0; act.sa_handler = handler_parent; if (sigaction (SIGALRM, &act, NULL)) perror ("sigaction (handler_parent)"); while (1) { alarm (30); comment (" PARENT: awaiting child status"); fflush (stderr); ret = waitpid ( (pid_t) -1, &status, WUNTRACED); fflush (stderr); if (ret == -1) { if (errno == EINTR) { comment (" PARENT: timed out, sending SIGCONT"); fflush (stderr); kill (child, SIGCONT); alarm (0); sleep (1); continue; } comment (" PARENT: waitpid failed"); kill (0, SIGKILL); exit (-1); } if (ret != child) { comment (" PARENT: unknown child"); kill (0, SIGKILL); exit (-1); } if (WIFSTOPPED (status)) { oksigs_stop [sig] = 1; comment (" PARENT: sending SIGCONT to stopped child"); kill (child, SIGCONT); alarm (0); sleep (1); continue; } if (WIFEXITED (status)) { if (WEXITSTATUS (status) != 1) comment (" PARENT: child exited abnormally"); else { oksigs [sig] = 1; comment (" PARENT: child exited normally"); } return; } if (WIFSIGNALED (status)) { comment(" PARENT: child killed by signal"); fprintf (stderr, "child process killed by signal %d\n", WTERMSIG (status)); return; } comment (" PARENT: invalid child status %x"); kill (0, SIGKILL); exit (-1); } } void test_signal (int nodefaults, int signal) { struct sigaction act; int sig; sigset_t set, oset; int ret; act.sa_flags = 0; act.sa_handler = handler; #ifdef LYNX_SIGTHREADKILL_HACK /* Attempting to test SIGTHREADKILL on LynxOS will kill both the child and the parent process: The call to sigaction fails and falls through to kill (0, SIGKILL). This code works around a problem specific to LynxOS, where signal 24 is reserved by the user space portion of the pthreads implementation. It should be replaced by a general mechanism for skipping problematic signals. */ if (signal == SIGTHREADKILL) { fprintf (stderr, "Reserved by C library.\n"); fflush (stderr); exit (-1); } #endif /* LYNX_SIGTHREADKILL_HACK */ if (sigaction (signal, &act, NULL)) { if (errno == EINVAL) { fprintf (stderr, "cannot be caught\n"); fflush (stderr); exit (-1); } else { fprintf (stderr, " *** sigaction: %s\n", strerror (errno)); fflush (stderr); kill (0, SIGKILL); exit (-1); } } if (! nodefaults) { act.sa_handler = SIG_IGN; if (sigaction (signal, &act, NULL)) { if (errno == EINVAL) { fprintf (stderr, "cannot be ignored\n"); fflush (stderr); exit (-1); } else { fprintf (stderr, " *** sigaction: %s\n", strerror (errno)); fflush (stderr); kill (0, SIGKILL); exit (-1); } } } if (! nodefaults) { act.sa_handler = SIG_DFL; if (sigaction (signal, &act, NULL)) { fprintf (stderr, " *** sigaction: %s\n", strerror (errno)); fflush (stderr); kill (0, SIGKILL); exit (-1); } } if (sigemptyset (&set)) perror ("sigemptyset"); if (sigaddset (&set, signal)) perror ("sigaddset"); if (sigaddset (&set, SIGALRM)) perror ("sigaddset"); comment (" masking signal"); if ((ret = pthread_sigmask (SIG_BLOCK, &set, NULL))) fprintf (stderr, " *** pthread_sigmask (SIG_BLOCK): %s\n", strerror (ret)); if ((ret = pthread_sigmask (SIG_BLOCK, &set, &oset))) fprintf (stderr, " *** pthread_sigmask (SIG_BLOCK 2): %s\n", strerror (ret)); if (sigismember (&oset, signal) == 0) { /* we are unable to mask this signal */ fprintf (stderr, "cannot be masked.\n"); exit (-1); } comment (" sending signal to self"); if (kill (getpid (), signal)) perror ("kill"); comment (" setting one second timeout"); alarm (1); comment (" doing sigwait"); #ifndef _CMA_OS_ if (ret = sigwait (&set, &sig)) { #else ret = sigwait (&set); if (ret == -1) ret = errno; else { sig = ret; ret = 0; } if (ret) { #endif fprintf (stderr, "*** sigwait: %s\n", strerror (ret)); } else if (sig == signal) { fprintf (stderr, "works OK.\n"); exit (1); /* signal is OK */ } else if (sig == SIGALRM) { fprintf (stderr, "*** timed out\n"); } else { fprintf (stderr, "*** wrong signal: %d\n", sig); } exit (-1); } void test_signals (int nodefaults, int *oksigs) { /* Test each signal, to see if it works with sigwait(). If nodefault != 0 then override the default treatment by installing a dummy handler. */ int i; int signal; pid_t child; if (nodefaults) fprintf (stderr, "testing signals without default treatments\n"); else fprintf (stderr, "testing signals with default treatments\n"); for (signal = 1; signal < nsigs; signal++) { for (i = 0; i < namedsigs; i++) if (sigs[i] == signal) break; if (i < namedsigs) fprintf (stderr, "testing signal: %2d %10s ...", signal, signames[i]); else fprintf (stderr, "testing signal: %2d ...", signal); fflush (stderr); if ((child = fork ())) parent_process (child, oksigs, signal); else { test_signal (nodefaults, signal); fprintf (stderr, "*** should never return ***"); exit (-1); } } } int main (int argc, char *argv[]){ int i; struct sigaction act; nsigs = guess_nsigs(); fprintf (stderr, "nsigs: %d\n", nsigs); oksigs = (int *) malloc (nsigs * sizeof (int)); oksigs_nodefault = (int *) malloc (nsigs * sizeof (int)); oksigs_stop = (int *) malloc (nsigs * sizeof (int)); for (i = 0; i < nsigs; i++) oksigs[i] = oksigs_nodefault[i] = oksigs_stop[i]= 0; act.sa_flags = 0; act.sa_handler = handler; if (sigaction (SIGALRM, &act, NULL)) perror ("sigaction (handler)"); #ifdef DEBUG comment ("sending 3 SIGALRM's, to test handler"); fflush (stderr); kill (getpid (), SIGALRM); kill (getpid (), SIGALRM); kill (getpid (), SIGALRM); #endif test_signals (0, oksigs); test_signals (1, oksigs_nodefault); print_package (oksigs, oksigs_nodefault, oksigs_stop); fprintf (stderr, "done.\n"); return 0; } florist-gpl-2017-src/INSTALL0000644000076700001450000000215612745606304015053 0ustar gnatmailgnatIn order to install FLORIST, you should go through the following steps: 0. Make sure you have GNAT installed and in front of your PATH. 1. Configure FLORIST by typing "./configure". You may want to use the --prefix=/florist/install option to specify where to install FLORIST. By default, Florist will be installed under /usr/local. If you are using a special configuration with no support or non standard support for tasking/threads, you may consider using the --disable-threads option: ./configure --disable-threads Note that disabling thread support will remove support for the following packages that depend on threads: - POSIX.Asynchronous_IO - POSIX.Condition_Variables - POSIX.Message_Queues - POSIX.Mutexes - POSIX.Process_Primitives - POSIX.Process_Signals - POSIX.Timers 2. Build and compile FLORIST by typing "make" If you need to specify optional gnatmake flags, or use an alternate gnatmake executable, you may specify GNATMAKE="gnatmake-cmd-line", e.g: make GNATMAKE="gnatmake --RTS=zcx" 3. Install FLORIST by typing "make install" florist-gpl-2017-src/INSTALL.LYNXOS50000644000076700001450000000076112100062573016160 0ustar gnatmailgnatWarning: This procedure is experimental and only partially tested. In order to install FLORIST for PowerPC LynxOS 5, you should go through the following steps: cp -p lynxos5/* . make -f Makefile.in GNATMAKE="powerpc-elf-lynxos5-gnatmake -gnatyN" \ CC=powerpc-elf-lynxos5-gcc \ DEPS=deps ADDRINFO_OBJECTS= \ SIGNALS_GENERATED=posix-implementation-ok_signals.ads \ GENERATED="posix-implementation.adb posix-timers-extensions.adb" make -f Makefile.in PREFIX= install florist-gpl-2017-src/c-posix.c0000644000076700001450000057012713106553473015560 0ustar gnatmailgnat/*---------------------------------------------------------------------------- -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- -- -- C - P O S I X . C -- -- -- -- -- -- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----------------------------------------------------------------------------*/ /* file: c-posix.c =============== This program generates the files: posix.ads, posix-limits.ads, posix-options.ads, posix-c.ads */ /* includes ======== Files pconfig.h and config.h are generated by the "configure" script, which in turn is generated by running "autoconf" on "configure.in". */ #include "confsrc/pconfig.h" #include #include #include #include #include "confsrc/config.h" #ifdef __hpux__ /* HP-UX headers define an obsolete (and wrong) OPEN_MAX when _XOPEN_SOURCE_EXTENDED is defined. Since we need this macro (_XOPEN.*) to get other POSIX definitions, we kludge here by undefining this unwanted symbol. */ #undef OPEN_MAX #endif int indent = 0; int ifprintf (FILE *stream, const char * format, ...) { va_list arg; int done; int i; va_start(arg, format); for (i = 0; i < indent; i++) fprintf(stream, " "); done = vfprintf(stream, format, arg); va_end(arg); return done; } /* Files pconfig.h and config.h are generated by the "configure" script, which in turn is generated by running "autoconf" on "configure.in". */ /* .... The following #define may belong in pconfig.h. Consider moving it there? */ /* TRY_MACRO_LINKNAMES activates a workaround for header files that define macros for certain POSIX function names, so that a substitute linkname is used. See macro GFUNC for more info. */ #define TRY_MACRO_LINKNAMES /* Macros ====== */ #define NON_SUPPORT_MESSAGE(NAME)\ ifprintf(fp," -- *** MISSING: %s *** --\n", NAME);\ warn("missing",NAME); /* universal constant declarations ------------------------------- In the original design, we did not account for the possibility of long integers coming out as negative with the "%d" format. We then added GUCST, but have only used it for known problem cases. By rights, we should go through all the POSIX symbols, find the ones that are used sa bit-masks, and make sure they all are put out using the unsigned format. */ #define GUCST(name, value) \ ifprintf(fp," %s : constant := %u;\n", name, value); #define GCST(name, value) \ ifprintf(fp," %s : constant := %d;\n", name, value); int max_GCST2; #define GCST2(name, name2, value) \ ifprintf(fp," %s,\n", name);\ ifprintf(fp," %s : constant := %d;\n", name2, value); \ if (value > max_GCST2) max_GCST2 = value; #define GDFLT(name, value) \ NON_SUPPORT_MESSAGE(name)\ ifprintf(fp," %s : constant := %d;\n", name, value); #define GUFLT(name, value) \ NON_SUPPORT_MESSAGE(name)\ ifprintf(fp," %s : constant := %u;\n", name, value); #define GDFLT2(name, name2) \ NON_SUPPORT_MESSAGE(name)\ GCST2(name, name2, -1); /* We use -1 for value above because this may be a missing errno value, for which 0 may mean no error. */ /* struct type definitions ----------------------- They are only to be used in the sequence GT1 (GT2 | GT2A | GT2V | GT2P)+ GT3. Do not interleave any other text or macros. */ /* GT1 --- start of code to generate a struct/record declaration C type name is struct TYPENAME Ada type name is struct_TYPENAME */ #define GT1(TYPENAME,WE_HAVE_IT)\ void g_struct_##TYPENAME(){\ int we_have_it = WE_HAVE_IT;\ struct TYPENAME DUMMY;\ char const typename [] = #TYPENAME;\ int typekind = STRUCT_TYPE;\ component_t comps [] = {\ /* GT1T ---- start of code to generate a struct/record declaration C type name is TYPENAME Ada type name is struct_TYPENAME */ #define GT1T(TYPENAME,WE_HAVE_IT)\ void g_##TYPENAME(){\ int we_have_it = WE_HAVE_IT;\ TYPENAME DUMMY;\ char const typename [] = #TYPENAME;\ int typekind = TYPEDEF_STRUCT_TYPE;\ component_t comps [] = {\ /* GT1R --- start of code to generate a struct/record declaration for structs that have a pointer to the struct type as a component. C type name is struct TYPENAME Ada type name is struct_TYPENAME */ #define GT1R(TYPENAME,WE_HAVE_IT)\ void g_struct_##TYPENAME(){\ int we_have_it = WE_HAVE_IT;\ struct TYPENAME DUMMY;\ char const typename [] = #TYPENAME;\ int typekind = RECURSIVE_STRUCT_TYPE;\ component_t comps [] = {\ /* GT2 --- component of struct/record type, non-aliased component name is COMPNAME component C type is CMPTYP function ada_type_name maps C type name to Ada */ #define GT2(COMPNAME,CMPTYP)\ #COMPNAME, #CMPTYP, sizeof(CMPTYP),\ ((char *)&DUMMY.COMPNAME - (char *)&DUMMY), 0, /* GT2_XPND_ARGS -------- As GT2, but expands any macros passed as arguments. */ #define GT2_XPND_ARGS(COMPNAME,CMPTYP)\ GT2(COMPNAME,CMPTYP) /* GT2A ---- variant of GT2, for component that is an array the component C type is CMPTYP which is an array with components of type CMPCMPTYP N is the number of components */ #define GT2A(COMPNAME,CMPTYP,CMPCMPTYP,N)\ #COMPNAME, #CMPTYP, sizeof(CMPCMPTYP)*N,\ ((char *)&DUMMY.COMPNAME - (char *)&DUMMY), 0, /* GT2V ---- variant of GT2, for component that is volatile */ #define GT2V(COMPNAME,CMPTYP)\ #COMPNAME, #CMPTYP, sizeof(CMPTYP),\ ((char *)&DUMMY.COMPNAME - (char *)&DUMMY), 1, /* GT2P ---- variant of GT2, for component that is a pointer to a function component name is COMPNAME component C type name is CMPTYP function ada_type_name maps C type name to Ada */ void (*DUMMYFPTR) (); #define GT2P(COMPNAME,CMPTYP)\ #COMPNAME, #CMPTYP, sizeof(DUMMYFPTR),\ ((char *)&DUMMY.COMPNAME - (char *)&DUMMY), 0, /* GT3 --- end of struct/record component list */ #define GT3\ 0, 0, 0, 0, 0};\ if (! we_have_it) {\ ifprintf(fp," -- *** MISSING: %s *** --\n", typename);\ warn("missing struct type",typename);}\ save_type(typename, sizeof(DUMMY), typekind, comps);\ print_type_declaration(typename,fp);} /* gen_unchckd_conv ---------------- generate an unchecked conversion FUNC from FROM to TO. */ #define gen_unchckd_conv(FUNC,FROM,TO)\ ifprintf(fp, " function %s is new Unchecked_Conversion (%s, %s);\n",\ FUNC, FROM, TO); /* gen_renaming ------------ generate a renaming ALIAS for ENT. */ #define gen_renaming(ALIAS,ENT)\ ifprintf(fp, " %s renames %s;\n", ALIAS, ENT); /* other macros ------------ */ #ifdef ENOSYS #else #define ENOSYS -1 #endif #define DEFAULTSIZE (sizeof(int)*bits_per_byte) /* the number of bits in the dummy type that is used to stand in for an unsupported type */ #define XTI_ERROR_FIRST 10000 #define XTI_ERROR_LAST 19999 #define EAI_ERROR_FIRST 20000 #define EAI_ERROR_LAST 29999 /* offsets applied to error codes from t_errno (T_xxxx) and codes from addrinfo (EAI_xxxxx). */ /* type declarations ================= */ /* We build a linked list structure to keep track of of information about POSIX types for which we might want to generate some output, either to the configuration files, or to an Ada package specification. */ typedef struct component { char * compname; /* name of component */ char * typename; /* definition of component type */ int size; /* sizeof (typename) */ int offset; /* offset of component, in bytes */ int is_volatile; /* 0 = nonvolatile, 1 = volatile */ } component_t; /* describes a record component */ /* type kinds */ #define SIGNED_INTEGER_TYPE 1 #define UNSIGNED_INTEGER_TYPE 2 #define STRUCT_TYPE 3 #define TYPEDEF_STRUCT_TYPE 4 #define OPAQUE_TYPE 5 #define CHAR_ARRAY_TYPE 6 #define RECURSIVE_STRUCT_TYPE 7 /* BLH */ /* .... may need to also define a case for union types .... may not need to distinquish struct from typedef */ typedef struct type { char *typename; int typesize; int typekind; int is_printed; component_t *comps; struct type *next; } type_t; /* describes a type */ type_t *all_type_list = NULL; type_t **all_type_tail = &all_type_list; /* subprograms =========== */ void warn(const char msg1[], const char msg2[]); void quit(const char msg1[], const char msg2[]); void save_type (char const name[], int typesize, int typekind, component_t *comps); void print_type_declaration(char const name[], FILE *fp); void gieeeheader(const char pkgname[]); void gspecheader(const char pkgname[]); void print_ada_type (char const typename[]); int wordsize(int n); void gbrg(char name[], char lb[], char ub[]); void gsitp(char name[], int size); void gdflsitp(char name[]); void guitp(char name[], int size); void gdfluitp(char name[]); void gptp(char name[], int size); void gptrtp(char const ptrname[], char const desname[]); void gdflptp(char name[]); void gfunc(char const name[], char const xname[], int have_it); void gfuncd(char const name[], char const xname[], int have_it); void gmaxi(char const name[], int lower_bound); void gmaxii(char const name[], int lower_bound); void gmaxn(char const name[], int lower_bound); void gmaxnn(char const name[], int lower_bound); void gpmaxn(char const name[], int value); void gpmaxr(char const name[], char const oname[]); void grename(char const name[], char const oname[]); void create_options(); void create_limits(); void create_posix(); void create_c(); /* variables ========= */ int bits_per_byte = 0; /* the number of bits in a byte, used for converting C "sizeof" return values to Ada 'size values */ char error_message[128]; /* a temporary buffer for building error messages It is global because we want to be able to return a pointer to it from inside a function. */ FILE *fp; /* current output file */ int network_byte_order; /* 1 means we have network order locally, and so don't need reordering */ /* Table of name to link name mappings ----------------------------------- The following table enumerates mappings to make from name to link name. */ char *name_to_linkname_table[] = { /* The following are variadic functions, so we call them via a wrapper in posix-macros.c. */ "open", "__gnat_florist_open", "sem_open", "__gnat_florist_sem_open", /* The following are implemented as macros on some platforms, so we call them via a wrapper in posix-macros.c. */ "stat", "__gnat_florist_stat", "fstat", "__gnat_florist_fstat", "lstat", "__gnat_florist_lstat", /* The following is implemented as an inline function on some platforms */ "uname", "__gnat_florist_uname", #if (_FILE_OFFSET_BITS == 64) && !defined(__LP64__) /* For a 32-bit system with large file support, force linking against 64-bit functions. */ "readdir", "readdir64", "readdir_r", "readdir64_r", "lseek", "lseek64", "ftruncate", "ftruncate64", /* Note: we already have C wrappers for stat/fstat/lstat so they do not need to be listed here. */ #elif __DARWIN_64_BIT_INO_T && !__DARWIN_ONLY_64_BIT_INO_T /* On Darwin some symbols are versioned to account for optional 64-bit inode numbers. */ "readdir", "readdir" __DARWIN_SUF_64_BIT_INO_T, "readdir_r", "readdir_r" __DARWIN_SUF_64_BIT_INO_T, #endif NULL }; /* Map a name to a linkname. */ const char *n2ln (const char *name) { char **i = name_to_linkname_table; while (*i) { if (strcmp (name, *i) == 0) return *(i + 1); i += 2; } return name; } /* declarations for C types ------------------------ If you make any changes here, also make changes where Ada types are put out, below. (***) */ /* the following are required by the C language standard */ void g_size_t(){ gsitp("size_t", sizeof(size_t)); gptrtp("size_t", "size_t"); } void g_time_t(){ gsitp("time_t", sizeof(time_t)); gptrtp("time_t", "time_t"); } void g_clock_t(){ guitp("clock_t", sizeof(clock_t)); gptrtp("clock_t", "clock_t"); } /* no sense configuring to do without the following types, since they are too basic */ void g_off_t(){gsitp("off_t", sizeof(off_t));} void g_pid_t(){gsitp("pid_t", sizeof(pid_t));} void g_gid_t(){guitp("gid_t", sizeof(gid_t));} void g_uid_t(){guitp("uid_t", sizeof(uid_t));} void g_mode_t(){guitp("mode_t", sizeof(mode_t));} void g_ssize_t(){gsitp("ssize_t", sizeof(ssize_t));} #ifdef HAVE_DIRENT_H void g_DIR(){DIR * x; gptp("DIR", sizeof(x));} #else void g_DIR(){gdflptp("DIR");} #endif #ifdef HAVE_ino_t void g_ino_t(){guitp("ino_t",sizeof(ino_t));} #else void g_ino_t(){gdfluitp("ino_t");} #endif #ifdef HAVE_dev_t void g_dev_t(){guitp("dev_t", sizeof(dev_t));} #else void g_dev_t(){gdfluitp("dev_t");} #endif #ifdef HAVE_nlink_t void g_nlink_t(){guitp("nlink_t", sizeof(nlink_t));} #else void g_nlink_t(){gdfluitp("nlink_t");} #endif #ifdef HAVE_blksize_t void g_blksize_t(){guitp("blksize_t", sizeof(blksize_t));} #else void g_blksize_t(){gdfluitp("blksize_t");} #endif #ifdef HAVE_blkcnt_t void g_blkcnt_t(){guitp("blkcnt_t", sizeof(blkcnt_t));} #else void g_blkcnt_t(){gdfluitp("blkcnt_t");} #endif #ifdef HAVE_cc_t void g_cc_t(){guitp("cc_t", sizeof(cc_t));} #else void g_cc_t(){gdfluitp("cc_t");} #endif #ifdef HAVE_tcflag_t void g_tcflag_t(){guitp("tcflag_t", sizeof(tcflag_t));} #else void g_tcflag_t(){gdfluitp("tcflag_t");} #endif #ifdef HAVE_clockid_t void g_clockid_t(){gsitp("clockid_t", sizeof(clockid_t));} #else void g_clockid_t(){gdflsitp("clockid_t");} #endif #ifdef HAVE_mqd_t void g_mqd_t(){gsitp("mqd_t", sizeof(mqd_t));} #else /* mqd_t must be signed, since the value -1 is used for error return */ void g_mqd_t(){gdflsitp("mqd_t");} #endif #ifdef HAVE_fd_set void g_fd_set(){gptp("fd_set", sizeof(fd_set));} #else void g_fd_set(){gdflptp("fd_set");} #endif #ifdef HAVE_pthread_attr_t void g_pthread_attr_t(){gptp("pthread_attr_t", sizeof(pthread_attr_t));} #else void g_pthread_attr_t(){gdflptp("pthread_attr_t");} #endif #ifdef HAVE_pthread_cond_t void g_pthread_cond_t(){gptp("pthread_cond_t", sizeof(pthread_cond_t));} #else void g_pthread_cond_t(){gdflptp("pthread_cond_t");} #endif #ifdef HAVE_pthread_condattr_t void g_pthread_condattr_t() {gptp("pthread_condattr_t", sizeof(pthread_condattr_t));} #else void g_pthread_condattr_t(){gdflptp("pthread_condattr_t");} #endif #ifdef HAVE_pthread_key_t void g_pthread_key_t(){gptp("pthread_key_t", sizeof(pthread_key_t));} #else void g_pthread_key_t(){gdflptp("pthread_key_t");} #endif #ifdef HAVE_pthread_mutex_t void g_pthread_mutex_t(){gptp("pthread_mutex_t", sizeof(pthread_mutex_t));} #else void g_pthread_mutex_t(){gdflptp("pthread_mutex_t");} #endif #ifdef HAVE_pthread_mutexattr_t void g_pthread_mutexattr_t() {gptp("pthread_mutexattr_t", sizeof(pthread_mutexattr_t));} #else void g_pthread_mutexattr_t(){gdflptp("pthread_mutexattr_t");} #endif #ifdef HAVE_pthread_once_t void g_pthread_once_t(){gptp("pthread_once_t", sizeof(pthread_once_t));} #else void g_pthread_once_t(){gdflptp("pthread_once_t");} #endif #ifdef HAVE_pthread_t void g_pthread_t(){gptp("pthread_t", sizeof(pthread_t));} #else void g_pthread_t(){gdflptp("pthread_t");} #endif #ifdef HAVE_sem_t void g_sem_t(){gptp("sem_t", sizeof(sem_t));} #else void g_sem_t(){gdflptp("sem_t");} #endif #ifdef HAVE_sigset_t void g_sigset_t(){gptp("sigset_t", sizeof(sigset_t));} #else void g_sigset_t(){gdflptp("sigset_t");} #endif #ifdef HAVE_speed_t void g_speed_t(){guitp("speed_t", sizeof(speed_t));} #else void g_speed_t(){gdfluitp("speed_t");} #endif #ifdef HAVE_socklen_t void g_socklen_t(){guitp("socklen_t", sizeof(socklen_t));} #else void g_socklen_t(){gdfluitp("socklen_t");} #endif #ifdef HAVE_timer_t void g_timer_t(){guitp("timer_t", sizeof(timer_t));} #else void g_timer_t(){gdfluitp("timer_t");} #endif /* sigval must precede siginfo_t and struct sigevent */ #ifdef HAVE_sigval #else union sigval { int sival_int; void *sival_ptr; }; #endif void g_sigval(){ #if defined(__hpux__) && defined(__ia64__) /* The definition of sigval on HP-UX for IA64 requires special treatment because the layout of the C type is unusual. */ ifprintf(fp," type Sigval_Int_Part is record\n"); ifprintf(fp," sival_int : int;\n"); ifprintf(fp," end record;\n"); ifprintf(fp," for Sigval_Int_Part use record\n"); ifprintf(fp," sival_int at 12 range 0 .. 31;\n"); ifprintf(fp," end record;\n"); ifprintf(fp," type Sigval_Ptr_Part is record\n"); ifprintf(fp," sival_ptr : System.Address;\n"); ifprintf(fp," end record;\n"); ifprintf(fp," for Sigval_Ptr_Part use record\n"); ifprintf(fp," sival_ptr at 8 range 0 .. 63;\n"); ifprintf(fp," end record;\n"); ifprintf(fp," type sigval (Dummy : Boolean := True) is record\n"); ifprintf(fp," case Dummy is\n"); ifprintf(fp," when True => Int_Part : Sigval_Int_Part;\n"); ifprintf(fp," when False => Ptr_Part : Sigval_Ptr_Part;\n"); ifprintf(fp," end case;\n"); ifprintf(fp," end record;\n"); ifprintf(fp," pragma Unchecked_Union (sigval);\n"); ifprintf(fp," null_sigval : constant sigval :=\n"); ifprintf(fp," (Dummy => False, Ptr_Part => (sival_ptr "); ifprintf(fp,"=> System.Null_Address));\n"); #else ifprintf(fp," type sigval (Dummy : Boolean := True) is record\n"); ifprintf(fp," case Dummy is\n"); ifprintf(fp," when True => sival_int : int;\n"); ifprintf(fp," when False => sival_ptr : System.Address;\n"); ifprintf(fp," end case;\n"); ifprintf(fp," end record;\n"); ifprintf(fp," pragma Unchecked_Union (sigval);\n"); ifprintf(fp," null_sigval : constant sigval :=\n"); ifprintf(fp," (Dummy => False, sival_ptr "); ifprintf(fp,"=> System.Null_Address);\n"); #endif ifprintf(fp," sigval_byte_size : constant := %d;\n", sizeof (union sigval)); ifprintf(fp," sigval_alignment : constant := ALIGNMENT;\n"); } /* siginfo_t must precede sigaction */ #ifdef HAVE_siginfo_t GT1T(siginfo_t, 1) #else typedef struct siginfo { int si_signo; int si_code; union sigval si_value; } siginfo_t; GT1T(siginfo_t, 0) #endif GT2(si_signo, int) GT2(si_code, int) GT2(si_value, union sigval) GT3 /* sigevent must precede aiocb */ #ifdef HAVE_struct_sigevent GT1(sigevent, 1) #else struct sigevent { int sigev_notify; int sigev_signo; union sigval sigev_value; /* void (*)(union sigval) sigev_notify_function; */ int sigev_notify_function; /* (pthread_attr_t *) sigev_notify_attributes; */ int sigev_notify_attributes; }; GT1(sigevent, 0) #endif GT2(sigev_notify,int) GT2(sigev_signo,int) GT2(sigev_value,union sigval) #ifdef HAVE_component_sigev_notify_function GT2(sigev_notify_function, void (*)(union sigval)) GT2(sigev_notify_attributes,pthread_attr_t *) #endif GT3 #ifdef HAVE_struct_aiocb GT1(aiocb, 1) #else struct aiocb { int aio_fildes; off_t aio_offset; volatile void * aio_buf; size_t aio_nbytes; int aio_reqprio; struct sigevent aio_sigevent; int aio_lio_opcode; }; GT1(aiocb, 0) #endif GT2(aio_fildes, int) GT2(aio_offset, off_t) GT2V(aio_buf, volatile void *) GT2(aio_nbytes, size_t) GT2(aio_reqprio, int) GT2(aio_sigevent, struct sigevent) GT2(aio_lio_opcode, int) GT3 #ifdef HAVE_struct_dirent GT1(dirent, 1) #else struct dirent { char d_name[1]; }; GT1(dirent, 0) #endif GT2A(d_name, POSIX_String (1 .. 1), char, 1) GT3 #ifdef HAVE_struct_flock GT1(flock, 1) #else struct flock { short l_type; short l_whence; off_t l_start; off_t l_len; pid_t l_pid; }; GT1(flock, 0) #endif GT2(l_type, short) GT2(l_whence, short) GT2(l_start, off_t) GT2(l_len, off_t) GT2(l_pid, pid_t) GT3 #ifdef HAVE_struct_group GT1(group, 1) #else struct group { char * gr_name; gid_t gr_gid; char ** gr_mem; }; GT1(group, 0) #endif GT2(gr_name, char *) GT2(gr_gid, gid_t) GT2(gr_mem, char **) GT3 #ifdef HAVE_struct_mq_attr GT1(mq_attr, 1) #else struct mq_attr { long mq_flags; long mq_maxmsg; long mq_msgsize; long mq_curmsgs; }; GT1(mq_attr, 0) #endif GT2(mq_flags, long) GT2(mq_maxmsg, long) GT2(mq_msgsize, long) GT2(mq_curmsgs, long) GT3 #ifdef HAVE_struct_passwd GT1(passwd, 1) #else struct passwd { char * pw_name; uid_t pw_uid; gid_t pw_gid; char * pw_dir; char * pw_shell; }; GT1(passwd, 0) #endif GT2(pw_name, char *) GT2(pw_uid, uid_t) GT2(pw_gid, gid_t) GT2(pw_dir, char *) GT2(pw_shell, char *) GT3 #if defined(HAVE_struct_sigaction) || defined(HAVE_struct_cma_sigaction) GT1(sigaction, 1) #else struct sigaction { void (*sa_handler)(); sigset_t sa_mask; int sa_flags; void (*sa_sigaction)(int,siginfo_t *, void *); }; GT1(sigaction, 0) #endif GT2P(sa_handler, System.Address) GT2(sa_mask, sigset_t) GT2(sa_flags, int) #ifdef HAVE_component_sa_sigaction GT2P(sa_sigaction, System.Address) #else #endif GT3 /* ....how to put message if a component, like sa_sigaction, if it is missing? consider putting a mark in the component descriptor. */ /* ....check P1003.1c to see what is the correct component name Provenzano uses "prio". We had "sched_priority". */ #ifdef HAVE_struct_sched_param GT1(sched_param, 1) #else struct sched_param { int sched_priority; }; GT1(sched_param, 0) #endif GT2(sched_priority, int) GT3 #ifdef HAVE_struct_stat GT1(stat, 1) #else struct stat { mode_t st_mode; ino_t st_ino; dev_t st_dev; nlink_t st_nlink; uid_t st_uid; gid_t st_gid; off_t st_size; blksize_t st_blksize; blkcnt_t st_blocks; time_t st_atime; time_t st_mtime; time_t st_ctime; }; GT1(stat, 0) #endif GT2(st_mode, mode_t) GT2(st_ino, ino_t) GT2(st_dev, dev_t) GT2(st_nlink, nlink_t) GT2(st_uid, uid_t) GT2(st_gid, gid_t) GT2(st_size, off_t) GT2(st_blksize, blksize_t) GT2(st_blocks, blkcnt_t) GT2(st_atime, time_t) GT2(st_mtime, time_t) GT2(st_ctime, time_t) GT3 #ifdef HAVE_struct_termios GT1(termios, 1) #else struct termios { tcflag_t c_iflag; tcflag_t c_oflag; tcflag_t c_cflag; tcflag_t c_lflag; cc_t c_cc[1]; }; GT1(termios, 0) #endif GT2(c_iflag, tcflag_t) GT2(c_oflag, tcflag_t) GT2(c_cflag, tcflag_t) GT2(c_lflag, tcflag_t) GT2A(c_cc, cc_t_array, cc_t, NCCS) GT3 #ifdef HAVE_suseconds_t #else #ifdef HAVE_struct_timeval struct timeval struct_timeval_temp; typedef __typeof__ (struct_timeval_temp.tv_usec) suseconds_t; #else typedef int suseconds_t; #endif #endif #ifdef HAVE_struct_timeval GT1(timeval, 1) #else struct timeval { time_t tv_sec; suseconds_t tv_usec; }; GT1(timeval, 0) #endif GT2(tv_sec, time_t) GT2(tv_usec, suseconds_t) GT3 struct timeval struct_timeval_dummy; void g_suseconds_t() {gsitp("suseconds_t", sizeof(struct_timeval_dummy.tv_usec));} #ifdef HAVE_struct_iovec GT1(iovec, 1) #else struct iovec { char * iov_base; size_t iov_len; }; GT1(iovec, 0) #endif GT2(iov_base, char *) GT2(iov_len, size_t) GT3 #ifdef HAVE_struct_timespec GT1(timespec, 1) #else struct timespec { time_t tv_sec; long tv_nsec; }; GT1(timespec, 0) #endif GT2(tv_sec,time_t) GT2(tv_nsec,long) GT3 #ifdef HAVE_struct_itimerspec GT1(itimerspec, 1) #else struct itimerspec { struct timespec it_interval; struct timespec it_value; }; GT1(itimerspec, 0) #endif GT2(it_interval, struct timespec) GT2(it_value, struct timespec) GT3 #ifdef HAVE_struct_tm GT1(tm, 1) #else struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; GT1(tm, 0) #endif GT2(tm_sec,int) GT2(tm_min,int) GT2(tm_hour,int) GT2(tm_mday,int) GT2(tm_mon,int) GT2(tm_year,int) GT2(tm_wday,int) GT2(tm_yday,int) GT2(tm_isdst,int) GT3 #ifdef HAVE_struct_tms GT1(tms, 1) #else struct tms { clock_t tms_utime; clock_t tms_stime; clock_t tms_cstime; clock_t tms_cutime; }; GT1(tms, 0) #endif GT2(tms_utime, clock_t) GT2(tms_stime, clock_t) GT2(tms_cutime, clock_t) GT2(tms_cstime, clock_t) GT3 #ifdef HAVE_struct_utimbuf GT1(utimbuf, 1) #else struct utimbuf { time_t modtime; time_t actime; }; GT1(utimbuf, 0) #endif GT2(modtime, time_t) GT2(actime, time_t) GT3 #ifdef HAVE_struct_utsname GT1(utsname, 1) #else struct utsname { char sysname [257]; char nodename [257]; char release [257]; char version [257]; char machine [257]; }; GT1(utsname, 0) #endif GT2A(sysname, utsname_sysname_string, char, sizeof(DUMMY.sysname)) GT2A(nodename, utsname_nodename_string, char, sizeof(DUMMY.nodename)) GT2A(release, utsname_release_string, char, sizeof(DUMMY.release)) GT2A(version, utsname_version_string, char, sizeof(DUMMY.version)) GT2A(machine, utsname_machine_string, char, sizeof(DUMMY.machine)) GT3 #ifdef HAVE_sa_family_t #else typedef unsigned short sa_family_t; #endif #ifdef HAVE_in_port_t #else typedef unsigned short in_port_t; #endif /* in_addr_t should be 4 bytes long It is likely to be defined as int or long, depending on the machine architecture. We use char[4] here if the system does not define an appropriate type. */ #ifdef HAVE_struct_in_addr #ifdef HAVE_in_addr_t #else typedef char in_addr_t[4]; #endif GT1(in_addr, 1) #else #ifdef HAVE_in_addr_t #else typedef char in_addr_t[4]; #endif struct in_addr { in_addr_t s_addr; }; GT1(in_addr, 0) #endif GT2(s_addr, in_addr_t) GT3 #ifdef HAVE_struct_sockaddr GT1(sockaddr, 1) #else struct sockaddr { sa_family_t sa_family; char sa_data [14]; }; GT1(sockaddr, 0) #endif GT2(sa_family, sa_family_t) GT2A(sa_data, POSIX_String (1 .. 14), char, sizeof (DUMMY.sa_data)) GT3 #ifdef HAVE_struct_sockaddr_un GT1(sockaddr_un, 1) #else struct sockaddr_un { sa_family_t sun_family; char sun_path [100]; }; GT1(sockaddr_un, 0) #endif GT2(sun_family, sa_family_t) GT2A(sun_path, sun_path_string, char, sizeof (DUMMY.sun_path)) GT3 #ifdef HAVE_struct_sockaddr_in GT1(sockaddr_in, 1) #else struct sockaddr_in { sa_family_t sin_family; in_port_t sin_port; struct in_addr sin_addr; char sin_zero [8]; }; GT1(sockaddr_in, 0) #endif GT2(sin_family, sa_family_t) GT2(sin_port, in_port_t) GT2(sin_addr, struct in_addr) GT2A(sin_zero, POSIX_String (1 .. 8), char, 8) GT3 #ifdef HAVE_struct_linger GT1(linger, 1) #else struct linger { int l_onoff; int l_linger; }; GT1(linger, 0) #endif GT2(l_onoff, int) GT2(l_linger, int) GT3 #ifdef HAVE_struct_msghdr GT1(msghdr, 1) #else struct msghdr { struct sockaddr * msg_name; size_t msg_namelen; struct iovec * msg_iov; size_t msg_iovlen; #ifdef _BSD4_3_ caddr_t msg_accrights; /* access rights sent/received */ int msg_accrightslen; #else char * msg_control; size_t msg_controllen; int msg_flags; #endif }; GT1(msghdr, 0) #endif GT2(msg_name, struct sockaddr *) GT2(msg_namelen, size_t) GT2(msg_iov, struct iovec *) GT2(msg_iovlen, size_t) #ifdef _BSD4_3_ GT2(msg_accrights,caddr_t) GT2(msg_accrightslen,int) #else #ifdef HAVE_component_msg_control GT2(msg_control, char *) #endif #ifdef HAVE_component_msg_controllen #if defined (__sparc__) && defined (__arch64__) GT2(msg_controllen, int) #else #ifdef HAVE_socklen_t GT2(msg_controllen, socklen_t) #else GT2(msg_controllen, size_t) #endif #endif #endif #ifdef HAVE_component_msg_flags GT2(msg_flags, int) #endif #endif GT3 #ifdef HAVE_struct_cmsghdr GT1(cmsghdr, 1) #else struct cmsghdr { int cmsg_level; int cmsg_type; size_t cmsg_len; }; GT1(cmsghdr, 0) #endif GT2(cmsg_level, int) GT2(cmsg_type, int) #if (defined (__sparc__) && defined (__arch64__)) GT2(cmsg_len, int) #elif HAVE_socklen_t GT2(cmsg_len, socklen_t) #else GT2(cmsg_len, size_t) #endif GT3 #ifdef HAVE_struct_ip_opts GT1(ip_opts, 1) #else struct ip_opts { struct in_addr ip_dst; char ip_opts[40]; }; GT1(ip_opts, 0) #endif GT2(ip_dst, struct in_addr) GT2A(ip_opts, POSIX.Octet_Array (1 .. 40), char, 40) GT3 #ifdef HAVE_struct_hostent GT1(hostent, 1) #else struct hostent { char * h_name; char ** h_aliases; int h_addrtype; int h_length; char ** h_addr_list; }; GT1(hostent, 0) #endif GT2(h_name, char *) GT2(h_aliases, char **) GT2(h_addrtype, int) GT2(h_length, int) GT2(h_addr_list, char **) GT3 #ifdef HAVE_struct_netent GT1(netent, 1) #else struct netent { char * n_name; char ** n_aliases; int n_addrtype; unsigned long n_net; }; GT1(netent, 0) #endif GT2(n_name, char *) GT2(n_aliases, char **) GT2(n_addrtype, int) GT2(n_net, in_addr_t) /* POSIX 1003.1g/D6.4 says n_net should be unsigned long, but it should be 4 bytes and unsigned long might be longer than that on some systems. Solaris 2.6 uses in_addr_t, which seems safer. */ GT3 #ifdef HAVE_struct_protoent GT1(protoent, 1) #else struct protoent { char * p_name; char ** p_aliases; int p_proto; }; GT1(protoent, 0) #endif GT2(p_name, char *) GT2(p_aliases, char **) GT2(p_proto, int) GT3 #ifdef HAVE_struct_servent GT1(servent, 1) #else struct servent { char * s_name; char ** s_aliases; int s_port; char * s_proto; }; GT1(servent, 0) #endif GT2(s_name, char *) GT2(s_aliases, char **) GT2(s_port, int) GT2(s_proto, char *) GT3 /* BLH : Changed GT1 to GT1R to handle addrinfo pointer */ #ifdef HAVE_struct_addrinfo GT1R(addrinfo, 1) #else struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; size_t ai_addrlen; struct sockaddr * ai_addr; char * ai_canonname; struct addrinfo * ai_next; }; GT1R(addrinfo, 0) #endif GT2(ai_flags, int) GT2(ai_family, int) GT2(ai_socktype, int) GT2(ai_protocol, int) /* Workaround layout issue on Sparc64 version 10. */ #if defined (__solaris10__) && defined (__arch64__) GT2(_ai_pad, int) GT2(ai_addrlen, int) #else GT2(ai_addrlen, size_t) #endif GT2(ai_addr, struct sockaddr *) GT2(ai_canonname, char *) GT2(ai_next, struct addrinfo *) GT3 /* XTI structs */ /* netbuf must precede all others */ #ifdef HAVE_struct_netbuf GT1(netbuf,1) #else struct netbuf { unsigned int maxlen; unsigned int len; char * buf; }; GT1(netbuf,0) #endif GT2(maxlen, unsigned int) GT2(len, unsigned int) GT2(buf, char *) GT3 /* t_info structure */ #ifndef XTI_TINFO_FTYPE #define XTI_TINFO_FTYPE long #endif #ifdef HAVE_struct_t_info GT1(t_info,1) #else struct t_info { XTI_TINFO_FTYPE addr; XTI_TINFO_FTYPE options; XTI_TINFO_FTYPE tsdu; XTI_TINFO_FTYPE etsdu; XTI_TINFO_FTYPE connect; XTI_TINFO_FTYPE discon; XTI_TINFO_FTYPE servtype; XTI_TINFO_FTYPE flags; }; GT1(t_info,0) #endif GT2_XPND_ARGS(addr, XTI_TINFO_FTYPE) GT2_XPND_ARGS(options, XTI_TINFO_FTYPE) GT2_XPND_ARGS(tsdu, XTI_TINFO_FTYPE) GT2_XPND_ARGS(etsdu, XTI_TINFO_FTYPE) GT2_XPND_ARGS(connect, XTI_TINFO_FTYPE) GT2_XPND_ARGS(discon, XTI_TINFO_FTYPE) GT2_XPND_ARGS(servtype, XTI_TINFO_FTYPE) #ifndef _TLI_ /* not xti compliant but usable */ GT2_XPND_ARGS(flags, XTI_TINFO_FTYPE) #endif GT3 /* t_opthdr structure */ #ifndef XTI_OPTHDR_FTYPE #define XTI_OPTHDR_FTYPE unsigned long #endif #ifdef HAVE_struct_t_opthdr GT1(t_opthdr,1) #else struct t_opthdr { XTI_OPTHDR_FTYPE len; XTI_OPTHDR_FTYPE level; XTI_OPTHDR_FTYPE name; XTI_OPTHDR_FTYPE status; }; GT1(t_opthdr,0) #endif GT2_XPND_ARGS(len, XTI_OPTHDR_FTYPE) GT2_XPND_ARGS(level, XTI_OPTHDR_FTYPE) GT2_XPND_ARGS(name, XTI_OPTHDR_FTYPE) GT2_XPND_ARGS(status, XTI_OPTHDR_FTYPE) GT3 /* t_bind structure */ #ifdef HAVE_struct_t_bind GT1(t_bind,1) #else struct t_bind { struct netbuf addr; unsigned qlen; }; GT1(t_bind,0) #endif GT2(addr, struct netbuf) GT2(qlen, unsigned) GT3 /* t_optmgmt structure */ #ifdef HAVE_struct_t_optmgmt GT1(t_optmgmt,1) #else struct t_optmgmt { struct netbuf opt; long flags; }; GT1(t_optmgmt,0) #endif GT2(opt, struct netbuf) GT2(flags, long) GT3 /* t_discon structure */ #ifdef HAVE_struct_t_discon GT1(t_discon,1) #else struct t_discon { struct netbuf udata; int reason; int sequence; }; GT1(t_discon,0) #endif GT2(udata, struct netbuf) GT2(reason, int) GT2(sequence, int) GT3 /* t_call structure */ #ifdef HAVE_struct_t_call GT1(t_call,1) #else struct t_call { struct netbuf addr; struct netbuf opt; struct netbuf udata; int sequence; }; GT1(t_call, 0) #endif GT2(addr, struct netbuf) GT2(opt, struct netbuf) GT2(udata, struct netbuf) GT2(sequence, int) GT3 /* t_unitdata structure */ #ifdef HAVE_struct_t_unitdata GT1(t_unitdata,1) #else struct t_unitdata { struct netbuf addr; struct netbuf opt; struct netbuf udata; }; GT1(t_unitdata,0) #endif GT2(addr, struct netbuf) GT2(opt, struct netbuf) GT2(udata, struct netbuf) GT3 /* t_uderr structure */ #ifdef HAVE_struct_t_uderr GT1(t_uderr,1) #else struct t_uderr { struct netbuf addr; struct netbuf opt; long error; }; GT1(t_uderr,0) #endif GT2(addr, struct netbuf) GT2(opt, struct netbuf) GT2(error, long) GT3 /* Sturcture used with linger option */ #ifndef XTI_LINGER_FTYPE #define XTI_LINGER_FTYPE long #endif #ifdef HAVE_struct_t_linger GT1(t_linger,1) #else struct t_linger { XTI_LINGER_FTYPE l_onoff; XTI_LINGER_FTYPE l_linger; }; GT1(t_linger,0) #endif GT2_XPND_ARGS(l_onoff, XTI_LINGER_FTYPE) GT2_XPND_ARGS(l_linger, XTI_LINGER_FTYPE) GT3 /* t_iovec structure */ #ifdef HAVE_struct_t_iovec GT1(t_iovec,1) #else struct t_iovec { char * iov_base; unsigned int iov_len; }; GT1(t_iovec,0) #endif GT2(iov_base, char *) GT2(iov_len, unsigned int) GT3 /* t_kpalive structure */ #ifndef XTI_KPALIVE_FTYPE #define XTI_KPALIVE_FTYPE long #endif #ifdef HAVE_struct_t_kpalive GT1(t_kpalive,1) #else struct t_kpalive { XTI_KPALIVE_FTYPE kp_onoff; XTI_KPALIVE_FTYPE kp_timeout; }; GT1(t_kpalive,0) #endif GT2_XPND_ARGS(kp_onoff, XTI_KPALIVE_FTYPE) GT2_XPND_ARGS(kp_timeout, XTI_KPALIVE_FTYPE) GT3 /* Poll/Select */ /* pollfd structure */ #ifdef HAVE_struct_pollfd GT1(pollfd,1) #else struct pollfd { int fd; short events; short revents; }; GT1(pollfd,0) #endif GT2(fd, int) GT2(events, short) GT2(revents, short) GT3 /* fd_set type ----------- POSIX.1G does not require fd_set to be a (visible) struct */ #ifdef HAVE_fd_set #else typedef struct fd_set { unsigned int fds_bits[32]; } fd_set; #endif /* warn ---- */ void warn(const char msg1[], const char msg2[]) { fprintf(stderr,"%s: %s\n",msg1,msg2); } /* quit ---- */ void quit(const char msg1[], const char msg2[]) { warn(msg1, msg2); exit(-1); } /* save_type --------- make a permanent copy of the information about a type with components, linked into a list on all_type_list, and return a pointer to the new node. */ void save_type (char const name[], int typesize, int typekind, component_t *comps) { type_t *tmp; int count; component_t *p; tmp = all_type_list; for (tmp=all_type_list; tmp && strcmp(tmp->typename,name); tmp=tmp->next); if (tmp) quit("DUPLICATE TYPE DEFINITION",name); tmp = malloc(sizeof(type_t)); tmp->typekind = typekind; tmp->is_printed = 0; count = strlen(name); tmp->typename = malloc(count+1); memcpy(tmp->typename,name,count+1); tmp->typesize = typesize; count = 0; if (comps) { for (p=comps;p->compname;p++) { /* Normalize component names by stripping out leading underscores. */ while (p -> compname [0] == '_') p -> compname++; count++; } tmp->comps = malloc((count+1)*sizeof(component_t)); memcpy(tmp->comps,comps,(count+1)*sizeof(component_t)); } tmp->next = NULL; *all_type_tail = tmp; all_type_tail = &tmp->next; } /* print_type_declaration ---------------------- print out Ada type declaration for C type with specified name */ void print_type_declaration(char const name[], FILE *fp) { type_t * type; component_t const * p; char extended_name[128]; type = all_type_list; for (type=all_type_list; type && strcmp(type->typename,name); type=type->next); if (type == NULL) { NON_SUPPORT_MESSAGE(name); return; } if (type->is_printed) ("TYPE ALREADY DECLARED",name); if (type->typekind == STRUCT_TYPE || type->typekind == RECURSIVE_STRUCT_TYPE) { if (strlen(type->typename)>=sizeof(extended_name)) { quit("type name too long",type->typename); } strcpy(extended_name,"struct_"); strcat(extended_name,type->typename); } else { if (strlen(type->typename)>=sizeof(extended_name)) { quit("type name too long",type->typename); } strcpy(extended_name,type->typename); } switch (type->typekind) { case SIGNED_INTEGER_TYPE: ifprintf(fp," type %s is range -2**%d .. (2**%d) - 1;\n", type->typename, type->typesize*bits_per_byte-1, type->typesize*bits_per_byte-1); ifprintf(fp," for %s'Size use %d;\n", extended_name, type->typesize*bits_per_byte); break; case UNSIGNED_INTEGER_TYPE: ifprintf(fp," type %s is mod 2**%d;\n", type->typename, type->typesize*bits_per_byte); ifprintf(fp," for %s'Size use %d;\n", extended_name, type->typesize*bits_per_byte); break; case STRUCT_TYPE: case TYPEDEF_STRUCT_TYPE: { component_t * p; int prev_offset = -1; ifprintf(fp," type %s is record\n", extended_name); for (p = type->comps; p && p->typename; p++) { ifprintf(fp," %s : ", p->compname); print_ada_type(p->typename); fprintf(fp,";\n"); if (p->is_volatile) ifprintf(fp," pragma Volatile (%s);\n", p->compname); } ifprintf(fp," end record;\n"); ifprintf(fp," for %s use record\n", extended_name); for (p = type->comps; p && p->compname; p++) { /* GNAT isn't able to handle overlapping components, so we add a simple minded test to prevent the most common cases */ if (p->offset == prev_offset) ifprintf(fp," -- *** OVERLAPPING component ***\n" " -- %s at %d range 0 .. %d;\n", p->compname, p->offset, p->size*bits_per_byte-1); else ifprintf(fp," %s at %d range 0 .. %d;\n", p->compname, p->offset, p->size*bits_per_byte-1); prev_offset = p->offset; } ifprintf(fp," end record;\n"); ifprintf(fp," pragma Convention (C_Pass_By_Copy, %s);\n", extended_name); ifprintf(fp," for %s'Alignment use ALIGNMENT;\n", extended_name); ifprintf(fp," pragma Warnings (Off);\n"); ifprintf(fp," -- There may be holes in the record, due to\n"); ifprintf(fp," -- components not defined by POSIX standard.\n"); ifprintf(fp," for %s'Size use %d;\n", extended_name, type->typesize*bits_per_byte); ifprintf(fp," pragma Warnings (On);\n"); gptrtp(type->typename, extended_name); break; } case RECURSIVE_STRUCT_TYPE: /* BLH */ { component_t * p; int prev_offset = -1; ifprintf(fp," type %s;\n", extended_name); gptrtp(type->typename, extended_name); ifprintf(fp," type %s is record\n", extended_name); for (p = type->comps; p && p->typename; p++) { ifprintf(fp," %s : ", p->compname); print_ada_type(p->typename); fprintf(fp,";\n"); if (p->is_volatile) ifprintf(fp," pragma Volatile (%s);\n", p->compname); } ifprintf(fp," end record;\n"); ifprintf(fp," for %s use record\n", extended_name); for (p = type->comps; p && p->compname; p++) { /* GNAT isn't able to handle overlapping components, so we add a simple minded test to prevent the most common cases */ if (p->offset == prev_offset) ifprintf(fp," -- *** OVERLAPPING component ***\n" " -- %s at %d range 0 .. %d;\n", p->compname, p->offset, p->size*bits_per_byte-1); else ifprintf(fp," %s at %d range 0 .. %d;\n", p->compname, p->offset, p->size*bits_per_byte-1); prev_offset = p->offset; } ifprintf(fp," end record;\n"); ifprintf(fp," pragma Convention (C_Pass_By_Copy, %s);\n", extended_name); ifprintf(fp," for %s'Alignment use ALIGNMENT;\n", extended_name); ifprintf(fp," pragma Warnings (Off);\n"); ifprintf(fp," -- There may be holes in the record, due to\n"); ifprintf(fp," -- components not defined by POSIX standard.\n"); ifprintf(fp," for %s'Size use %d;\n", extended_name, type->typesize*bits_per_byte); ifprintf(fp," pragma Warnings (On);\n"); break; } case CHAR_ARRAY_TYPE: ifprintf(fp," type %s is\n", extended_name); ifprintf(fp," array (1 .. %d) of char;\n", type->typesize); ifprintf(fp," for %s'Alignment use ALIGNMENT;\n", type->typename); gptrtp(type->typename,extended_name); break; case OPAQUE_TYPE: ifprintf(fp," type %s is\n", extended_name); ifprintf(fp," array (1 .. %d) of int;\n", wordsize(type->typesize)); ifprintf(fp," for %s'Alignment use ALIGNMENT;\n", type->typename); ifprintf(fp," for %s'Size use %d;\n", extended_name, type->typesize*bits_per_byte); gptrtp(type->typename,extended_name); break; default: break; } } #define IEEE_Header 1 #define FSU_Header 2 #define LMCo_Header 3 /* gheader ------- generate standard copyright header for automatically generated POSIX Ada binding package specification with name *pkgname */ void gheader(const char pkgname[], int header_kind) { int i; int namelen = strlen(pkgname); fprintf(fp,"-- DO NOT EDIT THIS FILE.\n"); fprintf(fp,"-- It is generated automatically, by program c-posix.c"); fprintf(fp,"\n"); fprintf(fp,"----------------------------------------"); fprintf(fp,"--------------------------------------\n"); fprintf(fp,"-- "); fprintf(fp," --\n"); if ((header_kind == FSU_Header || header_kind == LMCo_Header)) { fprintf(fp,"-- FLORIST (FSU Implementatio"); fprintf(fp,"n of POSIX.5) COMPONENTS --\n"); } else { fprintf(fp,"-- POSIX Ada95 Bindings for Protocol I"); fprintf(fp,"ndependent Interfaces (P1003.5c) --\n"); } fprintf(fp,"-- "); fprintf(fp," --\n"); fprintf(fp,"--"); for (i = 1; i<38-namelen; i++) fprintf(fp," "); for (i = 0; i= sizeof (int)) { save_type(name, size, OPAQUE_TYPE, NULL); } else { save_type(name, size, CHAR_ARRAY_TYPE, NULL); } print_type_declaration(name,fp); } /* gdflptp ------- generate default completion of private type declaration for C type not supported by the underlying OS */ void gdflptp(char name[]) { NON_SUPPORT_MESSAGE(name) gptp(name, DEFAULTSIZE/bits_per_byte); } /* GFUNC ------ macro wrapper for function gfunc, for cases where we are concerned that the function may have been renamed via a macro. This came up with DEC UNIX, for the pthread_-names. It also came up with HP-UX, for the pthread_-names. The extra layer of macro is to force expansion of name2 if it is a macro, even when we later quote it. */ #define GFUNC(name, have_it) GFUNCB(#name, name, have_it) #define GFUNCB(qname, qxname, have_it) gfunc(qname, #qxname, have_it) /* gfunc ----- generate constant for C name of function that notfies of errors by returning -1 with an error code in errno This lets us raise an exception for functions that are not available in the libraries. */ void gfunc(char const name[], char const xname[], int have_it) { if (have_it) { ifprintf (fp," HAVE_%s : constant Boolean := True;\n", name); if (strlen(name) > 20) { ifprintf(fp," %s_LINKNAME : constant String :=\n", name); ifprintf(fp," \"%s\";\n", n2ln(name)); } else ifprintf (fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(name)); } else { #ifdef TRY_MACRO_LINKNAMES if (strcmp(name, xname)) { /* We have a macro masquerading as a function name. If this code results in problems, #undef TRY_MACRO_LINKNAMES and recompile c-posix.c. These functions will then simply be treated as not available. */ ifprintf(fp," -- We guessed %s is implemented as a macro that\n", name); ifprintf(fp," -- expands to the real function name." " This is risky...\n"); if (strlen(name) > 20) { ifprintf(fp," %s_LINKNAME : constant String :=\n", name); ifprintf(fp," \"%s\";\n", n2ln(xname)); } else ifprintf (fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(xname)); } else #endif { ifprintf(fp," -- *** MISSING: function %s *** --\n", name); warn("missing function ", name); ifprintf (fp," HAVE_%s : constant Boolean := False;\n", name); ifprintf (fp," %s_LINKNAME : constant String := \"nosys_neg_one\";\n", name); } } } /* gfuncsol -------- variant of gfunc to work around feature of Solaris header files, which implement some POSIX functions by locally defined wrappers that call a real function whose name has the form __posix_XXX. */ void gfuncsol(char const name[], char const xname[]) { ifprintf(fp," -- We guessed %s is implemented as a wrapper\n", name); ifprintf(fp," -- that calls the real function. This is risky...\n"); ifprintf (fp," HAVE_%s : constant Boolean := True;\n", name); if (strlen(name) > 20) { ifprintf(fp," %s_LINKNAME : constant String :=\n", name); ifprintf(fp," \"%s\";\n", n2ln(xname)); } else ifprintf (fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(xname)); } /* GFUNCNS ------_ like GFUNC, but generates ENOTSUP instead of ENOSYS if the function is not supported. */ #define GFUNCNS(name, have_it) GFUNCNSB(#name, name, have_it) #define GFUNCNSB(qname, qxname, have_it) gfuncns(qname, #qxname, have_it) /* gfuncns ------- like gfunc, except uses ENOTSUP instead of ENOSYS if not supported */ void gfuncns(char const name[], char const xname[], int have_it) { if (have_it) { ifprintf (fp," HAVE_%s : constant Boolean := True;\n", name); if (strlen(name) > 20) { ifprintf(fp," %s_LINKNAME : constant String :=\n", name); ifprintf(fp," \"%s\";\n", n2ln(name)); } else ifprintf (fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(name)); } else { #ifdef TRY_MACRO_LINKNAMES if (strcmp(name, xname)) { /* We have a macro masquerading as a function name. If this code results in problems, #undef TRY_MACRO_LINKNAMES and recompile c-posix.c. These functions will then simply be treated as not available. */ ifprintf(fp," -- We guessed %s is implemented as a macro that\n", name); ifprintf(fp," -- expands to the real function name." " This is risky...\n"); if (strlen(name) > 20) { ifprintf(fp," %s_LINKNAME : constant String :=\n", name); ifprintf(fp," \"%s\";\n", n2ln(xname)); } else ifprintf (fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(xname)); } else #endif { ifprintf(fp," -- *** MISSING: function %s *** --\n", name); warn("missing function ", name); ifprintf (fp," HAVE_%s : constant Boolean := False;\n", name); ifprintf (fp," %s_LINKNAME : constant String := \"notsup_neg_one\";\n", name); } } } /* GFUNCD ------ macro wrapper for function gfuncd, for cases where we are concerned that the function may have been renamed via a macro. This came up with DEC UNIX, for the pthread_-names. The extra layer of macro is to force expansion of name2 if it is a macro, even when we later quote it. */ #define GFUNCD(name, have_it) GFUNCDB(#name, name, have_it) #define GFUNCDB(qname, qxname, have_it) gfuncd(qname, #qxname, have_it) /* gfuncd ------ same as gfunc, except for function that notifies of errors by returning an error code directly. */ void gfuncd(char const name[], char const xname[], int have_it) { if (have_it) { if (strlen(name) > 20) { ifprintf(fp," %s_LINKNAME : constant String :=\n", name); ifprintf(fp," \"%s\";\n", n2ln(name)); } else ifprintf (fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(name)); } else { #ifdef TRY_MACRO_LINKNAMES if (strcmp(name, xname)) { /* We have a macro masquerading as a function name. If this results in problems, #undef TRY_MACRO_LINKNAMES and recompile c-posix.c. These functions will then simply be treated as not available. */ ifprintf(fp," -- Apparently this function is actually a macro.\n"); ifprintf(fp," -- We are guessing that" " the macro expands to a linkable name.\n"); ifprintf(fp," -- This is risky...\n"); if (strlen(name) > 20) { ifprintf(fp," %s_LINKNAME : constant String :=\n", name); ifprintf(fp," \"%s\";\n", n2ln(xname)); } else ifprintf (fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(xname)); } else #endif { ifprintf(fp," -- *** MISSING: function %s *** --\n", name); warn("missing function ", name); if (strlen(name) > 20) { ifprintf(fp," %s_LINKNAME : constant String :=\n", name); ifprintf(fp," \"nosys_direct\";\n", name); } else ifprintf (fp," %s_LINKNAME : constant String := \"nosys_direct\";\n", name); } } } /* GFUNCDNS -------- like GFUNCD, except that error code is ENOTSUP if not supported */ #define GFUNCDNS(name, have_it) GFUNCDNSB(#name, name, have_it) #define GFUNCDNSB(qname, qxname, have_it) gfuncdns(qname, #qxname, have_it) /* gfuncdns -------- same as gfuncd, except that error code for nonsupport is ENOTSUP */ void gfuncdns(char const name[], char const xname[], int have_it) { if (have_it) { if (strlen(name) > 20) { ifprintf(fp," %s_LINKNAME : constant String :=\n", name); ifprintf(fp," \"%s\";\n", n2ln(name)); } else ifprintf (fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(name)); } else { #ifdef TRY_MACRO_LINKNAMES if (strcmp(name, xname)) { /* We have a macro masquerading as a function name. If this results in problems, #undef TRY_MACRO_LINKNAMES and recompile c-posix.c. These functions will then simply be treated as not available. */ ifprintf(fp," -- Apparently this function is actually a macro.\n"); ifprintf(fp," -- We are guessing that" " the macro expands to a linkable name.\n"); ifprintf(fp," -- This is risky...\n"); if (strlen(name) > 20) { ifprintf(fp," %s_LINKNAME : constant String :=\n", name); ifprintf(fp," \"%s\";\n", n2ln(xname)); } else ifprintf (fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(xname)); } else #endif { ifprintf(fp," -- *** MISSING: function %s *** --\n", name); warn("missing function ", name); if (strlen(name) > 20) { ifprintf(fp," %s_LINKNAME : constant String :=\n", name); ifprintf(fp," \"notsup_direct\";\n", name); } else ifprintf (fp," %s_LINKNAME : constant String := \"notsup_direct\";\n", name); } } } /* gmaxn ----- generate _Maxima subtype of Natural */ void gmaxn(char const name[], int lower_bound) { ifprintf(fp," subtype %s_Maxima is Natural range\n",name); ifprintf(fp," %d .. Natural'Last;\n",lower_bound); } /* gmaxnn ----- generate _Maxima subtype of Natural with tight bound */ void gmaxnn(char const name[], int bound) { ifprintf(fp," subtype %s_Maxima is Natural range\n",name); ifprintf(fp," %d .. %d;\n", bound, bound); } /* gmaxi ----- generate _Maxima subtype of IO_Count */ void gmaxi(char const name[], int lower_bound) { ifprintf(fp," subtype %s_Maxima is IO_Count range\n",name); ifprintf(fp," %d .. IO_Count'Last;\n",lower_bound); } /* gmaxi ----- generate _Maxima subtype of IO_Count with tight range */ void gmaxii(char const name[], int bound) { ifprintf(fp," subtype %s_Maxima is IO_Count range\n",name); ifprintf(fp," %d .. %d;\n", bound, bound); } /* gpmaxi ------ generate portable maximum constant of type IO_Count with specified value */ void gpmaxi(char const name[], int value) { ifprintf(fp," Portable_%s_Maximum :\n",name); ifprintf(fp," constant IO_Count := %d;\n",value); } /* gpmaxn ------ generate portable maximum constant of type Natural with specified value */ void gpmaxn(char const name[], int value) { ifprintf(fp," Portable_%s_Maximum :\n",name); ifprintf(fp," constant Natural := %d;\n",value); } /* gpmaxr ------ generate portable maximum constant of type Natural as renaming of constant in package POSIX */ void gpmaxr(char const name[], char const oname[]) { ifprintf(fp," Portable_%s_Maximum : Natural\n",name); ifprintf(fp," renames POSIX.Portable_%s_Maximum;\n",oname); } /* gpmaxrioc --------- generate portable maximum constant of type IO_Count as renaming of constant in package POSIX */ void gpmaxrioc(char const name[], char const oname[]) { ifprintf(fp," Portable_%s_Maximum : POSIX.IO_Count\n",name); ifprintf(fp," renames POSIX.Portable_%s_Maximum;\n",oname); } /* grename ------- */ void grename (char const name[], char const oname[]) { ifprintf(fp," subtype %s is\n",name); ifprintf(fp," POSIX.%s;\n",oname); } /* gmacrofunc ---------- */ void gmacrofunc (char const funcname[], char const parmtype[], char const parmname[]) { ifprintf(fp," function %s (%s : %s) return int;\n", funcname, parmname, parmtype); ifprintf(fp," pragma Import (C, %s, \"%s\");\n", funcname, funcname); } /* create_options -------------- create package POSIX.Options, in file posix-options.ads */ void create_options() { fprintf(stderr,"creating package POSIX_Options\n"); if (! (fp = fopen (GENDIR "/posix-options.ads", "w"))) { perror ("posix-options.ads"); quit("can't open file to write",""); } gheader("POSIX.Options", IEEE_Header); ifprintf(fp,"package POSIX.Options is\n"); #ifdef _POSIX_ASYNCHRONOUS_IO gbrg("Asynchronous_IO_Support", "True", "True"); #else #ifdef _POSIX_ASYNC_IO #if (_POSIX_ASYNC_IO == -1) gbrg("Asynchronous_IO_Support", "False", "False"); #else gbrg("Asynchronous_IO_Support", "True", "True"); #endif #else gbrg("Asynchronous_IO_Support", "False", "True"); #endif #endif grename("Change_Owner_Restriction","Change_Owner_Restriction"); grename("Filename_Truncation","Filename_Truncation"); #ifdef _POSIX_FSYNC gbrg("File_Synchronization_Support", "True", "True"); #else gbrg("File_Synchronization_Support", "False", "True"); #endif grename("Job_Control_Support","Job_Control_Support"); #ifdef _POSIX_MAPPED_FILES gbrg("Memory_Mapped_Files_Support", "True", "True"); #else gbrg("Memory_Mapped_Files_Support", "False", "True"); #endif #ifdef _POSIX_MEMLOCK gbrg("Memory_Locking_Support", "True", "True"); #else gbrg("Memory_Locking_Support", "False", "True"); #endif #ifdef _POSIX_MEMLOCK_RANGE gbrg("Memory_Range_Locking_Support", "True", "True"); #else gbrg("Memory_Range_Locking_Support", "False", "True"); #endif #ifdef _POSIX_MEMORY_PROTECTION gbrg("Memory_Protection_Support", "True", "True"); #else gbrg("Memory_Protection_Support", "False", "True"); #endif #ifdef _POSIX_MESSAGE_PASSING gbrg("Message_Queues_Support", "True", "True"); #else gbrg("Message_Queues_Support", "False", "True"); #endif grename("Saved_IDs_Support","Saved_IDs_Support"); gbrg("Mutexes_Support", "True", "True"); #ifdef _POSIX_PRIORITIZED_IO gbrg("Prioritized_IO_Support", "True", "True"); #else #ifdef _POSIX_PRIO_IO #if (_POSIX_PRIO_IO == -1) gbrg("Prioritized_IO_Support", "False", "False"); #else gbrg("Prioritized_IO_Support", "True", "True"); #endif #else gbrg("Prioritized_IO_Support", "False", "True"); #endif #endif #ifdef _POSIX_PRIORITY_SCHEDULING gbrg("Priority_Process_Scheduling_Support", "True", "True"); #ifdef _POSIX_THREADS gbrg("Priority_Task_Scheduling_Support", "True", "True"); #else gbrg("Priority_Task_Scheduling_Support", "False", "False"); #endif #else gbrg("Priority_Process_Scheduling_Support", "False", "True"); gbrg("Priority_Task_Scheduling_Support", "False", "False"); #endif #ifdef _POSIX_REALTIME_SIGNALS gbrg("Realtime_Signals_Support", "True", "True"); #else gbrg("Realtime_Signals_Support", "False", "True"); #endif #ifdef _POSIX_SEMAPHORES gbrg("Semaphores_Support", "True", "True"); #else gbrg("Semaphores_Support", "False", "True"); #endif #ifdef _POSIX_SHARED_MEMORY_OBJECTS gbrg("Shared_Memory_Objects_Support", "True", "True"); #else gbrg("Shared_Memory_Objects_Support", "False", "True"); #endif gbrg("Signal_Entries_Support", "True", "True"); #ifdef _POSIX_SYNCHRONIZED_IO gbrg("Synchronized_IO_Support", "True", "True"); #else #ifdef _POSIX_SYNC_IO #if (_POSIX_SYNC_IO == -1) gbrg("Synchronized_IO_Support", "False", "False"); #else gbrg("Synchronized_IO_Support", "True", "True"); #endif #else gbrg("Synchronized_IO_Support", "False", "True"); #endif #endif #ifdef _POSIX_THREAD_PRIO_PROTECT gbrg("Mutex_Priority_Ceiling_Support", "True", "True"); #else gbrg("Mutex_Priority_Ceiling_Support", "False", "True"); #endif #ifdef _POSIX_THREAD_PRIO_INHERIT gbrg("Mutex_Priority_Inheritance_Support", "True", "True"); #else gbrg("Mutex_Priority_Inheritance_Support", "False", "True"); #endif #ifdef _POSIX_THREAD_PROCESS_SHARED gbrg("Process_Shared_Support", "True", "True"); #else gbrg("Process_Shared_Support", "False", "True"); #endif #ifdef _POSIX_TIMERS gbrg("Timers_Support", "True", "True"); #else gbrg("Timers_Support", "False", "True"); #endif /* options from POSIX.5c [D2] */ /* What does _POSIX_PII map to in Ada? #ifdef _POSIX_PII gbrg("????_Support", "True", "True"); #else gbrg("????_Support", "False", "True"); #endif */ #ifdef _POSIX_PII_XTI gbrg("XTI_DNI_Support", "True", "True"); #else gbrg("XTI_DNI_Support", "False", "True"); #endif #ifdef _POSIX_PII_INTERNET_DGRAM gbrg("Internet_Datagram_Support", "True", "True"); #else gbrg("Internet_Datagram_Support", "False", "True"); #endif #ifdef _POSIX_PII_INTERNET gbrg("Internet_Protocol_Support", "True", "True"); #else gbrg("Internet_Protocol_Support", "False", "True"); #endif #ifdef _POSIX_PII_INTERNET_STREAM gbrg("Internet_Stream_Support", "True", "True"); #else gbrg("Internet_Stream_Support", "False", "True"); #endif #ifdef _POSIX_PII_OSI gbrg("ISO_OSI_Protocol_Support", "True", "True"); #else gbrg("ISO_OSI_Protocol_Support", "False", "True"); #endif #ifdef _POSIX_PII_OSI_M gbrg("OSI_Minimal_Support", "True", "True"); #else gbrg("OSI_Minimal_Support", "False", "True"); #endif #ifdef _POSIX_PII_OSI_COTS gbrg("OSI_Connection_Support", "True", "True"); #else gbrg("OSI_Connection_Support", "False", "True"); #endif #ifdef _POSIX_PII_OSI_CLTS gbrg("OSI_Connectionless_Support", "True", "True"); #else gbrg("OSI_Connectionless_Support", "False", "True"); #endif #ifdef _POSIX_POLL gbrg("Poll_Support", "True", "True"); #else gbrg("Poll_Support", "False", "True"); #endif #ifdef _POSIX_SELECT gbrg("Select_Support", "True", "True"); #else gbrg("Select_Support", "False", "True"); #endif #ifdef _POSIX_PII_SOCKET gbrg("Sockets_DNI_Support", "True", "True"); #else gbrg("Sockets_DNI_Support", "False", "True"); #endif #ifdef _POSIX_PII_NET_SUPPORT gbrg("Network_Management_Support", "True", "True"); #else gbrg("Network_Management_Support", "False", "True"); #endif ifprintf(fp,"end POSIX.Options;\n"); fclose (fp); fprintf(stderr,"done generating posix-options.ads\n"); } /* create_limits ------------- create package POSIX.Limits, in file posix-limits.ads */ void create_limits() { fprintf(stderr,"creating package POSIX_Limits\n"); if (! (fp = fopen (GENDIR "/posix-limits.ads", "w"))) { perror ("posix-limits.ads"); quit("can't open file to write",""); } gheader("POSIX.Limits", IEEE_Header); ifprintf(fp,"package POSIX.Limits is\n"); ghdrcmnt("Portable System Limits"); ifprintf(fp," -- .... Change P1003.5b?\n"); ifprintf(fp," -- to allow these constants\n"); ifprintf(fp," -- to be larger than the minimum values specified.\n\n"); gpmaxr("Argument_List","Argument_List"); ifprintf(fp," Portable_Asynchronous_IO_Maximum :\n"); ifprintf(fp," constant Natural := 1;\n"); gpmaxr("Child_Processes","Child_Processes"); ifprintf(fp," Portable_Clock_Resolution_Minimum :\n"); ifprintf(fp," constant := 20_000_000;\n"); /* notice that this is a MINIMUM, so we don't use gpmax */ gpmaxr("Filename","Filename_Limit"); gpmaxr("Groups","Groups"); gpmaxrioc("Input_Line","Input_Line_Limit"); gpmaxrioc("Input_Queue","Input_Queue_Limit"); gpmaxr("Links","Link_Limit"); #ifdef _POSIX_AIO_LISTIO_MAX gpmaxn("List_IO",_POSIX_AIO_LISTIO_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_AIO_LISTIO_MAX"); gpmaxn("List_IO", 2); #endif #ifdef _POSIX_MQ_PRIO_MAX gpmaxn("Message_Priority",_POSIX_MQ_PRIO_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_MQ_PRIO_MAX"); gpmaxn("Message_Priority", 32); #endif gpmaxr("Open_Files","Open_Files"); #ifdef _POSIX_MQ_OPEN_MAX gpmaxn("Open_Message_Queues",_POSIX_MQ_OPEN_MAX); #else gpmaxn("Open_Message_Queues",8); #endif gpmaxr("Pathname","Pathname_Limit"); gpmaxrioc("Pipe_Length","Pipe_Limit"); #ifdef _POSIX_SIGQUEUE_MAX gpmaxn("Queued_Signals",_POSIX_SIGQUEUE_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_SIGQUEUE_MAX"); gpmaxn("Queued_Signals", 32); #endif #ifdef _POSIX_RTSIG_MAX gpmaxn("Realtime_Signals",_POSIX_RTSIG_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_RTSIG_MAX"); gpmaxn("Realtime_Signals",8); #endif #ifdef _POSIX_SEM_NSEMS_MAX gpmaxn("Semaphores",_POSIX_SEM_NSEMS_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_SEM_NSEMS_MAX"); gpmaxn("Semaphores", 256); #endif #ifdef _POSIX_SEM_VALUE_MAX gpmaxn("Semaphores_Value",_POSIX_SEM_VALUE_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_SEM_VALUE_MAX"); gpmaxn("Semaphores_Value", 32767); #endif gpmaxr("Streams","Stream"); #ifdef _POSIX_DELAYTIMER_MAX gpmaxn("Timer_Overruns",_POSIX_DELAYTIMER_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_DELAYTIMER_MAX"); gpmaxn("Timer_Overruns", 32); #endif #ifdef _POSIX_TIMER_MAX gpmaxn("Timers",_POSIX_TIMER_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_NTIMER_MAX") gpmaxn("Timers", 32); #endif gpmaxr("Time_Zone_String","Time_Zone_String"); fprintf(fp,"\n"); ifprintf(fp," -- limits from POSIX.5c [D2]\n\n"); #ifdef _POSIX_FD_SETSIZE gpmaxn("File_Descriptor_Set", _POSIX_FD_SETSIZE); #else gpmaxr("File_Descriptor_Set", "Open_Files"); #endif #ifdef _POSIX_HIWAT gpmaxi("Socket_Buffer", _POSIX_HIWAT); #else gpmaxrioc("Socket_Buffer", "Pipe_Limit"); #endif #ifdef _POSIX_UIO_MAXIOV gpmaxn("Socket_IO_Vector", _POSIX_UIO_MAXIOV); #else gpmaxn("Socket_IO_Vector", 16); #endif #ifdef _POSIX_QLIMIT gpmaxn("Socket_Connection", _POSIX_QLIMIT); #else gpmaxn("Socket_Connection", 1); #endif #ifdef _POSIX_UIO_MAXIOV gpmaxn("XTI_IO_Vector", _POSIX_UIO_MAXIOV); #else gpmaxn("XTI_IO_Vector", 16); #endif ghdrcmnt("Configurable Limits"); grename("Argument_List_Maxima","Argument_List_Maxima"); #ifdef AIO_MAX gmaxnn("Asynchronous_IO",AIO_MAX); #else #ifdef _POSIX_AIO_MAX gmaxn("Asynchronous_IO",_POSIX_AIO_MAX); #else gmaxn("Asynchronous_IO", 1); #endif #endif #ifdef AIO_PRIO_DELTA_MAX gmaxnn("Asynchronous_IO_Priority_Delta",AIO_PRIO_DELTA_MAX); #else gmaxn("Asynchronous_IO_Priority_Delta", 0); #endif grename("Child_Processes_Maxima","Child_Processes_Maxima"); grename("Filename_Maxima","Filename_Limit_Maxima"); grename("Groups_Maxima","Groups_Maxima"); grename("Input_Line_Maxima","Input_Line_Limit_Maxima"); grename("Input_Queue_Maxima","Input_Queue_Limit_Maxima"); grename("Links_Maxima","Link_Limit_Maxima"); #ifdef AIO_LISTIO_MAX gmaxnn("List_IO",AIO_LISTIO_MAX); #else #ifdef _POSIX_AIO_LISTIO_MAX gmaxn("List_IO",_POSIX_AIO_LISTIO_MAX); #else gmaxn("List_IO", 2); #endif #endif #ifdef MQ_PRIO_MAX gmaxnn("Message_Priority",MQ_PRIO_MAX); #else #ifdef _POSIX_MQ_PRIO_MAX gmaxn("Message_Priority",_POSIX_MQ_PRIO_MAX); #else gmaxn("Message_Priority", 32); #endif #endif #ifdef MQ_OPEN_MAX gmaxnn("Open_Message_Queues",MQ_OPEN_MAX); #else #ifdef _POSIX_MQ_OPEN_MAX gmaxn("Open_Message_Queues",_POSIX_MQ_OPEN_MAX); #else gmaxn("Open_Message_Queues", 8); #endif #endif grename("Open_Files_Maxima","Open_Files_Maxima"); ifprintf(fp," subtype Page_Size_Range "); #ifdef PAGESIZE ifprintf(fp," is Natural range %d .. %d;\n", PAGESIZE, PAGESIZE); #else #ifdef _SC_PAGESIZE ifprintf(fp," is Natural range %d .. %d;\n", sysconf(_SC_PAGESIZE), sysconf(_SC_PAGESIZE)); #else ifprintf(fp," is Natural range 0 .. -1;\n"); #endif #endif grename("Pathname_Maxima","Pathname_Limit_Maxima"); grename("Pipe_Length_Maxima","Pipe_Limit_Maxima"); #ifdef SIGQUEUE_MAX gmaxnn("Queued_Signals",SIGQUEUE_MAX); #else #ifdef _POSIX_SIGQUEUE_MAX gmaxn("Queued_Signals",_POSIX_SIGQUEUE_MAX); #else gmaxn("Queued_Signals", 32); #endif #endif #ifdef RTSIG_MAX gmaxnn("Realtime_Signals",RTSIG_MAX); #else #ifdef _POSIX_RTSIG_MAX gmaxn("Realtime_Signals",_POSIX_RTSIG_MAX); #else gmaxn("Realtime_Signals",8); #endif #endif #ifdef SEM_NSEMS_MAX gmaxnn("Semaphores",SEM_NSEMS_MAX); #else #ifdef _POSIX_SEM_NSEMS_MAX gmaxn("Semaphores",_POSIX_SEM_NSEMS_MAX); #else gmaxn("Semaphores", 256); #endif #endif #ifdef SEM_VALUE_MAX /* Semaphores_Value bounds are declared as Natural, and thus cannot exceed INT_MAX. */ if (SEM_VALUE_MAX > INT_MAX) gmaxnn("Semaphores_Value",INT_MAX); else gmaxnn("Semaphores_Value",SEM_VALUE_MAX); #else #ifdef _POSIX_SEM_VALUE_MAX gmaxn("Semaphores_Value",_POSIX_SEM_VALUE_MAX); #else gmaxn("Semaphores_Value", 32767); #endif #endif grename("Streams_Maxima","Stream_Maxima"); #ifdef DELAYTIMER_MAX gmaxnn("Timer_Overruns",DELAYTIMER_MAX); #else #ifdef _POSIX_DELAYTIMER_MAX gmaxn("Timer_Overruns",_POSIX_DELAYTIMER_MAX); #else gmaxn("Timer_Overruns", 32); #endif #endif #ifdef TIMER_MAX gmaxnn("Timers",TIMER_MAX); #else #ifdef _POSIX_TIMER_MAX gmaxn("Timers",_POSIX_TIMER_MAX); #else gmaxn("Timers", 32); #endif #endif grename("Time_Zone_String_Maxima","Time_Zone_String_Maxima"); /* limits from POSIX.5c/D4 */ fprintf(fp,"\n"); fprintf(fp," -- limits from POSIX.5c [D2]\n\n"); #ifdef FD_SETSIZE gmaxnn("File_Descriptor_Set", FD_SETSIZE); #else #ifdef _POSIX_FD_SETSIZE gmaxn("File_Descriptor_Set", _POSIX_FD_SETSIZE); #else #ifdef _POSIX_PIPE_BUF gmaxn("File_Descriptor_Set", _POSIX_PIPE_BUF); #else gmaxn("File_Descriptor_Set", 8); #endif #endif #endif #ifdef SOCK_MAXBUF gmaxii("Socket_Buffer", SOCK_MAXBUF); #else #ifdef _POSIX_PIPE_BUF gmaxi("Socket_Buffer", _POSIX_PIPE_BUF); #else gmaxi("Socket_Buffer", 8); #endif #endif #ifdef UIO_MAXIOV gmaxnn ("Socket_IO_Vector", UIO_MAXIOV); #else #ifdef _POSIX_UIO_MAXIOV gmaxn ("Socket_IO_Vector", _POSIX_UIO_MAXIOV); #else gmaxn ("Socket_IO_Vector", 16); #endif #endif #ifdef _POSIX_QLIMIT gmaxn ("Socket_Connection", _POSIX_QLIMIT); #else gmaxn ("Socket_Connection", 1); #endif #ifdef T_IOV_MAX gmaxnn ("XTI_IO_Vector", T_IOV_MAX); #else #ifdef _POSIX_UIO_MAXIOV gmaxn("XTI_IO_Vector", _POSIX_UIO_MAXIOV); #else gmaxn("XTI_IO_Vector", 16); #endif #endif ifprintf(fp,"end POSIX.Limits;\n"); fclose (fp); fprintf(stderr,"done generating posix-limits.ads\n"); } /* create_posix ------------ create package POSIX, in file posix.ads */ void create_posix() { int max_posix_error; int XTI_Error_First; int XTI_Error_Last; int EAI_Error_First; int EAI_Error_Last; int count; /* The Makefile is responsible for defining LIBS correctly */ #ifdef LIBS char libs[] = LIBS, *s1, *s2; #endif fprintf(stderr,"creating package POSIX\n"); if (! (fp = fopen (GENDIR "/posix.ads", "w"))) { perror ("posix.ads"); quit("can't open file to write",""); } gheader("POSIX", IEEE_Header); ifprintf(fp,"with Ada.Streams;\n"); ifprintf(fp,"with Interfaces;\n"); ifprintf(fp,"package POSIX is\n\n"); #ifdef LIBS /* Generate one pragma Linker_Options per library */ for (s1 = libs; *s1; ) { for (s2 = s1; *s2 && *s2 != ' '; s2++); if (*s2) { *s2 = '\0'; ifprintf(fp," pragma Linker_Options (\"%s\");\n", s1); s1 = s2 + 1; } else s1 = s2; } #endif fprintf(fp,"\n"); ifprintf(fp," -- 2.4.1 Constants and Static Subtypes\n\n"); fprintf(fp," -- Version Identification\n\n"); #ifdef _POSIX_VERSION GCST("POSIX_Version", _POSIX_VERSION); #else GDFLT("POSIX_Version", 0); #endif ifprintf(fp," POSIX_Ada_Version : constant := 1995_00;\n\n"); ifprintf(fp," -- Optional Facilities (obsolescent, 0)\n"); ifprintf(fp," -- See package POSIX.Limits for preferred interfaces.\n\n"); #ifdef _POSIX_JOB_CONTROL gbrg("Job_Control_Support", "True", "True"); #else gbrg("Job_Control_Support", "False", "True"); #endif #ifdef _POSIX_SAVED_IDS gbrg("Saved_IDs_Support", "True", "True"); #else gbrg("Saved_IDs_Support", "False", "False"); #endif #ifdef _POSIX_CHOWN_RESTRICTED #if (_POSIX_CHOWN_RESTRICTED == -1) gbrg("Change_Owner_Restriction", "False", "False"); #else gbrg("Change_Owner_Restriction", "True", "True"); #endif #else gbrg("Change_Owner_Restriction", "False", "True"); #endif #ifdef _POSIX_NO_TRUNC #if (_POSIX_NO_TRUNC == -1) gbrg("Filename_Truncation", "False", "False"); #else gbrg("Filename_Truncation", "True", "True"); #endif #else gbrg("Filename_Truncation", "False", "True"); #endif ifprintf(fp," -- Bytes and I/O Counts\n\n"); ifprintf(fp," Byte_Size : constant := %d;\n\n",bits_per_byte); ifprintf(fp," type IO_Count is range -2**%d .. (2**%d) - 1;\n\n", sizeof(ssize_t)*bits_per_byte-1, sizeof(ssize_t)*bits_per_byte-1); ifprintf(fp," for IO_Count'Size use %d;\n", sizeof(ssize_t)*bits_per_byte); gmaxi("IO_Count", 32767); ifprintf(fp," -- System Limits (obsolescent)\n"); ifprintf(fp," -- See package POSIX.Limits for preferred interfaces.\n\n"); /* Run-Time Increasable Values These must be defined, but the actual limits, as reported by sysconf(), may be higher. */ #ifdef _POSIX_NGROUPS_MAX gpmaxn("Groups",_POSIX_NGROUPS_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_NGROUPS_MAX"); gpmaxn("Groups", 0); #endif #ifdef NGROUPS_MAX /* run-time increasable value */ gmaxn("Groups",NGROUPS_MAX); #else #ifdef _POSIX_NGROUPS_MAX gmaxn("Groups", _POSIX_NGROUPS_MAX); #else gmaxn("Groups", 0); #endif #endif /* Runtime Invariant Values These need not be defined. If defined, these are reliable static bounds, not to be exceeded by the sysconf() result. */ #ifdef _POSIX_ARG_MAX gpmaxn("Argument_List",_POSIX_ARG_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_ARG_MAX"); gpmaxn("Argument_List",4096); #endif #ifdef ARG_MAX gmaxnn("Argument_List", ARG_MAX); #else #ifdef _POSIX_ARG_MAX gmaxn("Argument_List", _POSIX_ARG_MAX); #else gmaxn("Argument_List",4096); #endif #endif #ifdef _POSIX_CHILD_MAX gpmaxn("Child_Processes",_POSIX_CHILD_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_CHILD_MAX"); gpmaxn("Child_Processes",6); #endif #ifdef CHILD_MAX gmaxnn("Child_Processes", CHILD_MAX); #else #ifdef _POSIX_CHILD_MAX gmaxn("Child_Processes", _POSIX_CHILD_MAX); #else gmaxn("Child_Processes",6); #endif #endif #ifdef _POSIX_OPEN_MAX gpmaxn("Open_Files",_POSIX_OPEN_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_OPEN_MAX"); gpmaxn("Open_Files", 16); #endif #ifdef OPEN_MAX gmaxnn("Open_Files", OPEN_MAX); #else #ifdef _POSIX_OPEN_MAX gmaxn("Open_Files", _POSIX_OPEN_MAX); #else gmaxn("Open_Files", 16); #endif #endif #ifdef _POSIX_STREAM_MAX gpmaxn("Stream",_POSIX_STREAM_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_STREAM_MAX"); gpmaxn("Stream",8); #endif #ifdef STREAM_MAX gmaxnn("Stream", STREAM_MAX); #else #ifdef _POSIX_STREAM_MAX gmaxn("Stream", _POSIX_STREAM_MAX); #else gmaxn("Stream",8); #endif #endif #ifdef _POSIX_TZNAME_MAX gpmaxn("Time_Zone_String",_POSIX_TZNAME_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_TZNAME_MAX"); gpmaxn("Time_Zone_String", 3); #endif #ifdef TZNAME_MAX gmaxnn("Time_Zone_String", TZNAME_MAX); #else #ifdef _POSIX_TZNAME_MAX gmaxn("Time_Zone_String", _POSIX_TZNAME_MAX); #else gmaxn("Time_Zone_String", 3); #endif #endif /* Pathname Variable Values These need not be defined. If defined, these are reliable static bounds, not to be exceeded by pathconf() result. */ ifprintf(fp," -- Pathname Variable Values (obsolescent)\n"); ifprintf(fp," -- See package POSIX.Limits for preferred" " interfaces.\n\n"); #ifdef _POSIX_LINK_MAX gpmaxn("Link_Limit",_POSIX_LINK_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_LINK_MAX"); gpmaxn("Link_Limit",8); #endif #ifdef LINK_MAX gmaxnn("Link_Limit", LINK_MAX); #else #ifdef _POSIX_LINK_MAX gmaxn("Link_Limit", _POSIX_LINK_MAX); #else gmaxn("Link_Limit",8); #endif #endif #ifdef _POSIX_MAX_INPUT gpmaxi("Input_Line_Limit",_POSIX_MAX_INPUT); #else NON_SUPPORT_MESSAGE("_POSIX_MAX_INPUT"); gpmaxi("Input_Line_Limit", 255); #endif #ifdef MAX_INPUT gmaxii("Input_Line_Limit",MAX_INPUT); #else #ifdef _POSIX_MAX_INPUT gmaxi("Input_Line_Limit", _POSIX_MAX_INPUT); #else gmaxi("Input_Line_Limit", 255); #endif #endif #ifdef _POSIX_MAX_CANON gpmaxi("Input_Queue_Limit",_POSIX_MAX_CANON); #else NON_SUPPORT_MESSAGE("_POSIX_MAX_CANON"); gpmaxi("Input_Queue_Limit", 255); #endif #ifdef MAX_CANON gmaxii("Input_Queue_Limit", MAX_CANON); #else #ifdef _POSIX_MAX_CANON gmaxi("Input_Queue_Limit", _POSIX_MAX_CANON); #else gmaxi("Input_Queue_Limit", 255); #endif #endif #ifdef _POSIX_NAME_MAX gpmaxn("Filename_Limit",_POSIX_NAME_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_NAME_MAX"); gpmaxn("Filename_Limit", 14); #endif #ifdef NAME_MAX gmaxnn("Filename_Limit", NAME_MAX); #else #ifdef _POSIX_NAME_MAX gmaxn("Filename_Limit", _POSIX_NAME_MAX); #else gmaxn("Filename_Limit", 14); #endif #endif #ifdef _POSIX_PATH_MAX gpmaxn("Pathname_Limit",_POSIX_PATH_MAX); #else NON_SUPPORT_MESSAGE("_POSIX_PATH_MAX"); gpmaxn("Pathname_Limit", 255); #endif #ifdef PATH_MAX gmaxnn("Pathname_Limit", PATH_MAX); #else #ifdef _POSIX_PATH_MAX gmaxn("Pathname_Limit", _POSIX_PATH_MAX); #else gmaxn("Pathname_Limit", 255); #endif #endif #ifdef _POSIX_PIPE_BUF gpmaxi("Pipe_Limit",_POSIX_PIPE_BUF); #else gpmaxi("Pipe_Limit", 512); #endif #ifdef PIPE_BUF gmaxii("Pipe_Limit", PIPE_BUF); #else #ifdef _POSIX_PIPE_BUF gmaxi("Pipe_Limit", _POSIX_PIPE_BUF); #else gmaxi("Pipe_Limit", 512); #endif #endif ifprintf(fp," -- Blocking Behavior Values\n"); ifprintf(fp," type Blocking_Behavior is (Tasks, Program, Special);\n"); ifprintf(fp," subtype Text_IO_Blocking_Behavior is Blocking_Behavior\n"); ifprintf(fp," range Tasks .. Tasks;\n"); ifprintf(fp," IO_Blocking_Behavior :"); ifprintf(fp," constant Blocking_Behavior\n"); ifprintf(fp," := Tasks;\n"); ifprintf(fp," File_Lock_Blocking_Behavior :"); ifprintf(fp," constant Blocking_Behavior\n"); ifprintf(fp," := Tasks;\n"); ifprintf(fp," Wait_For_Child_Blocking_Behavior :"); ifprintf(fp," constant Blocking_Behavior\n"); ifprintf(fp," := Tasks;\n"); ifprintf(fp," subtype Realtime_Blocking_Behavior is Blocking_Behavior\n"); ifprintf(fp," range Tasks .. Program;\n"); ifprintf(fp," -- Signal Masking\n"); ifprintf(fp," type Signal_Masking is "); ifprintf(fp,"(No_Signals, RTS_Signals, All_Signals);\n"); ifprintf(fp," -- Characters and Strings\n"); ifprintf(fp," type POSIX_Character is new Standard.Character;\n"); ifprintf(fp," -- We rely here on the fact that the GNAT" " type Character\n"); ifprintf(fp," -- is the same as the GCC type char in C,\n"); ifprintf(fp," -- which in turn must be the same as POSIX_Character.\n\n"); ifprintf(fp," NUL : constant POSIX_Character := POSIX_Character (ASCII.NUL);\n"); ifprintf(fp," SOH : constant POSIX_Character := POSIX_Character (ASCII.SOH);\n"); ifprintf(fp," STX : constant POSIX_Character := POSIX_Character (ASCII.STX);\n"); ifprintf(fp," ETX : constant POSIX_Character := POSIX_Character (ASCII.ETX);\n"); ifprintf(fp," EOT : constant POSIX_Character := POSIX_Character (ASCII.EOT);\n"); ifprintf(fp," ENQ : constant POSIX_Character := POSIX_Character (ASCII.ENQ);\n"); ifprintf(fp," ACK : constant POSIX_Character := POSIX_Character (ASCII.ACK);\n"); ifprintf(fp," BEL : constant POSIX_Character := POSIX_Character (ASCII.BEL);\n"); ifprintf(fp," BS : constant POSIX_Character := POSIX_Character (ASCII.BS);\n"); ifprintf(fp," HT : constant POSIX_Character := POSIX_Character (ASCII.HT);\n"); ifprintf(fp," LF : constant POSIX_Character := POSIX_Character (ASCII.LF);\n"); ifprintf(fp," VT : constant POSIX_Character := POSIX_Character (ASCII.VT);\n"); ifprintf(fp," FF : constant POSIX_Character := POSIX_Character (ASCII.FF);\n"); ifprintf(fp," CR : constant POSIX_Character := POSIX_Character (ASCII.CR);\n"); ifprintf(fp," SO : constant POSIX_Character := POSIX_Character (ASCII.SO);\n"); ifprintf(fp," SI : constant POSIX_Character := POSIX_Character (ASCII.SI);\n"); ifprintf(fp," DLE : constant POSIX_Character := POSIX_Character (ASCII.DLE);\n"); ifprintf(fp," DC1 : constant POSIX_Character := POSIX_Character (ASCII.DC1);\n"); ifprintf(fp," DC2 : constant POSIX_Character := POSIX_Character (ASCII.DC2);\n"); ifprintf(fp," DC3 : constant POSIX_Character := POSIX_Character (ASCII.DC3);\n"); ifprintf(fp," DC4 : constant POSIX_Character := POSIX_Character (ASCII.DC4);\n"); ifprintf(fp," NAK : constant POSIX_Character := POSIX_Character (ASCII.NAK);\n"); ifprintf(fp," SYN : constant POSIX_Character := POSIX_Character (ASCII.SYN);\n"); ifprintf(fp," ETB : constant POSIX_Character := POSIX_Character (ASCII.ETB);\n"); ifprintf(fp," CAN : constant POSIX_Character := POSIX_Character (ASCII.CAN);\n"); ifprintf(fp," EM : constant POSIX_Character := POSIX_Character (ASCII.EM);\n"); ifprintf(fp," SUB : constant POSIX_Character := POSIX_Character (ASCII.SUB);\n"); ifprintf(fp," ESC : constant POSIX_Character := POSIX_Character (ASCII.ESC);\n"); ifprintf(fp," FS : constant POSIX_Character := POSIX_Character (ASCII.FS);\n"); ifprintf(fp," GS : constant POSIX_Character := POSIX_Character (ASCII.GS);\n"); ifprintf(fp," RS : constant POSIX_Character := POSIX_Character (ASCII.RS);\n"); ifprintf(fp," US : constant POSIX_Character := POSIX_Character (ASCII.US);\n\n"); ifprintf(fp," type POSIX_String is array (Positive range <>) "); ifprintf(fp,"of aliased POSIX_Character;\n"); ifprintf(fp," function To_POSIX_String (Str : String) "); ifprintf(fp,"return POSIX_String;\n"); ifprintf(fp," function To_POSIX_String (Str : Wide_String) "); ifprintf(fp,"return POSIX_String;\n"); ifprintf(fp," function To_String (Str : POSIX_String) return String;\n"); ifprintf(fp," function To_Wide_String (Str : POSIX_String) "); ifprintf(fp,"return Wide_String;\n"); ifprintf(fp," function To_Stream_Element_Array (Buffer : POSIX_String)\n"); ifprintf(fp," return Ada.Streams.Stream_Element_Array;\n"); ifprintf(fp," function To_POSIX_String (Buffer : "); ifprintf(fp,"Ada.Streams.Stream_Element_Array)\n"); ifprintf(fp," return POSIX_String;\n"); ifprintf(fp," subtype Filename is POSIX_String;\n"); ifprintf(fp," subtype Pathname is POSIX_String;\n"); ifprintf(fp," function Is_Filename (Str : POSIX_String)" " return Boolean;\n"); ifprintf(fp," function Is_Pathname (Str : POSIX_String)" " return Boolean;\n"); ifprintf(fp," function Is_Portable_Filename (Str : POSIX_String)"); ifprintf(fp," return Boolean;\n"); ifprintf(fp," function Is_Portable_Pathname (Str : POSIX_String)"); ifprintf(fp," return Boolean;\n"); ifprintf(fp," -- String Lists\n"); ifprintf(fp," type POSIX_String_List is limited private;\n"); ifprintf(fp," Empty_String_List : constant POSIX_String_List;\n"); ifprintf(fp," procedure Make_Empty (List : in out POSIX_String_List);\n"); ifprintf(fp," procedure Append (List : in out POSIX_String_List;\n"); ifprintf(fp," Str : POSIX_String);\n"); ifprintf(fp," generic\n"); ifprintf(fp," with procedure Action\n"); ifprintf(fp," (Item : POSIX_String;\n"); ifprintf(fp," Quit : in out Boolean);\n"); ifprintf(fp," procedure For_Every_Item (List : POSIX_String_List);\n"); ifprintf(fp," function Length (List : POSIX_String_List) "); ifprintf(fp,"return Natural;\n"); ifprintf(fp," function Value\n"); ifprintf(fp," (List : POSIX_String_List;\n"); ifprintf(fp," Index : Positive) return POSIX_String;\n"); ifprintf(fp," -- option sets\n"); ifprintf(fp," type Option_Set is private;\n"); ifprintf(fp," function Empty_Set return Option_Set;\n"); ifprintf(fp," function \"+\" (L, R : Option_Set) return Option_Set;\n"); ifprintf(fp," function \"-\" (L, R : Option_Set) return Option_Set;\n"); ifprintf(fp," function \"<\" (Left, Right : Option_Set)" " return Boolean;\n"); ifprintf(fp," function \"<=\"(Left, Right : Option_Set)" " return Boolean;\n"); ifprintf(fp," function \">\" (Left, Right : Option_Set)" " return Boolean;\n"); ifprintf(fp," function \">=\"(Left, Right : Option_Set)" " return Boolean;\n"); { int i; for (i =1; i<32; i++) { ifprintf(fp," Option_%d : constant Option_Set;\n", i); } } ifprintf(fp," -- Exceptions and error codes\n"); ifprintf(fp," POSIX_Error : exception;\n"); gsitp("Error_Code", sizeof(int)); ifprintf(fp," function Get_Error_Code return Error_Code;\n"); ifprintf(fp," procedure Set_Error_Code (Error : Error_Code);\n"); ifprintf(fp," function Is_POSIX_Error (Error : Error_Code) "); ifprintf(fp,"return Boolean;\n"); ifprintf(fp," function Image (Error : Error_Code) return String;\n"); ifprintf(fp," No_Error : constant Error_Code := 0;\n"); ifprintf(fp," -- Error code constants with negative values "); ifprintf(fp,"correspond to\n"); ifprintf(fp," -- error codes that are not supported by the "); ifprintf(fp,"current system.\n"); ifprintf(fp," -- error codes\n"); max_GCST2 = 0; #ifdef E2BIG GCST2("E2BIG", "Argument_List_Too_Long", E2BIG); #else GDFLT2("E2BIG", "Argument_List_Too_Long"); #endif #ifdef EACCES GCST2("EACCES", "Permission_Denied", EACCES); #else GDFLT2("EACCES", "Permission_Denied"); #endif #ifdef EADDRINUSE GCST2("EADDRINUSE", "Address_In_Use", EADDRINUSE); #else GDFLT2("EADDRINUSE", "Address_In_Use"); #endif #ifdef EADDRNOTAVAIL GCST2("EADDRNOTAVAIL", "Address_Not_Available", EADDRNOTAVAIL); #else GDFLT2("EADDRNOTAVAIL", "Address_Not_Available"); #endif #ifdef EAFNOSUPPORT GCST2("EAFNOSUPPORT", "Inappropriate_Family", EAFNOSUPPORT); #else GDFLT2("EAFNOSUPPORT", "Inappropriate_Family"); #endif #ifdef EAGAIN GCST2("EAGAIN", "Resource_Temporarily_Unavailable", EAGAIN); #else GDFLT2("EAGAIN", "Resource_Temporarily_Unavailable"); #endif #ifdef EALREADY GCST2("EALREADY", "Already_Awaiting_Connection", EALREADY); #else GDFLT2("EALREADY", "Already_Awaiting_Connection"); #endif #ifdef EBADF GCST2("EBADF", "Bad_File_Descriptor", EBADF); #else GDFLT2("EBADF", "Bad_File_Descriptor"); #endif #ifdef EBADMSG GCST2("EBADMSG", "Bad_Message", EBADMSG); #else GDFLT2("EBADMSG", "Bad_Message"); #endif #ifdef EBUSY GCST2("EBUSY", "Resource_Busy", EBUSY); #else GDFLT2("EBUSY", "Resource_Busy"); #endif #ifdef ECANCELED GCST2("ECANCELED", "Operation_Canceled", ECANCELED); #else GDFLT2("ECANCELED", "Operation_Canceled"); #endif #ifdef ECHILD GCST2("ECHILD", "No_Child_Process", ECHILD); #else GDFLT2("ECHILD", "No_Child_Process"); #endif #ifdef ECONNABORTED GCST2("ECONNABORTED", "Connection_Aborted", ECONNABORTED); #else GDFLT2("ECONNABORTED", "Connection_Aborted"); #endif #ifdef ECONNREFUSED GCST2("ECONNREFUSED", "Connection_Refused", ECONNREFUSED); #else GDFLT2("ECONNREFUSED", "Connection_Refused"); #endif #ifdef ECONNRESET GCST2("ECONNRESET", "Connection_Reset", ECONNRESET); #else GDFLT2("ECONNRESET", "Connection_Reset"); #endif #ifdef EDEADLK GCST2("EDEADLK", "Resource_Deadlock_Avoided", EDEADLK); #else GDFLT2("EDEADLK", "Resource_Deadlock_Avoided"); #endif #ifdef EDOM GCST2("EDOM", "Domain_Error", EDOM); #else GDFLT2("EDOM", "Domain_Error"); #endif #ifdef EEXIST GCST2("EEXIST", "File_Exists", EEXIST); #else GDFLT2("EEXIST", "File_Exists"); #endif #ifdef EFAULT GCST2("EFAULT", "Bad_Address", EFAULT); #else GDFLT2("EFAULT", "Bad_Address"); #endif #ifdef EFBIG GCST2("EFBIG", "File_Too_Large", EFBIG); #else GDFLT2("EFBIG", "File_Too_Large"); #endif #ifdef EHOSTDOWN GCST2("EHOSTDOWN", "Host_Down", EHOSTDOWN); #else GDFLT2("EHOSTDOWN", "Host_Down"); #endif #ifdef EHOSTUNREACH GCST2("EHOSTUNREACH", "Host_Unreachable", EHOSTUNREACH); #else GDFLT2("EHOSTUNREACH", "Host_Unreachable"); #endif #ifdef EINPROGRESS GCST2("EINPROGRESS", "Operation_In_Progress", EINPROGRESS); #else GDFLT2("EINPROGRESS", "Operation_In_Progress"); #endif #ifdef EINTR GCST2("EINTR", "Interrupted_Operation", EINTR); #else GDFLT2("EINTR", "Interrupted_Operation"); #endif #ifdef EINVAL GCST2("EINVAL", "Invalid_Argument", EINVAL); #else GDFLT2("EINVAL", "Invalid_Argument"); #endif #ifdef EIO GCST2("EIO", "Input_Output_Error", EIO); #else GDFLT2("EIO", "Input_Output_Error"); #endif #ifdef EISCONN GCST2("EISCONN", "Is_Already_Connected", EISCONN); #else GDFLT2("EISCONN", "Is_Already_Connected"); #endif #ifdef EISDIR GCST2("EISDIR", "Is_A_Directory", EISDIR); #else GDFLT2("EISDIR", "Is_A_Directory"); #endif #ifdef EMFILE GCST2("EMFILE", "Too_Many_Open_Files", EMFILE); #else GDFLT2("EMFILE", "Too_Many_Open_Files"); #endif #ifdef EMLINK GCST2("EMLINK", "Too_Many_Links", EMLINK); #else GDFLT2("EMLINK", "Too_Many_Links"); #endif #ifdef EMSGSIZE GCST2("EMSGSIZE", "Message_Too_Long", EMSGSIZE); #else GDFLT2("EMSGSIZE", "Message_Too_Long"); #endif #ifdef ENAMETOOLONG GCST2("ENAMETOOLONG", "Filename_Too_Long", ENAMETOOLONG); #else GDFLT2("ENAMETOOLONG", "Filename_Too_Long"); #endif #ifdef ENETDOWN GCST2("ENETDOWN", "Network_Down", ENETDOWN); #else GDFLT2("ENETDOWN", "Network_Down"); #endif #ifdef ENETRESET GCST2("ENETRESET", "Network_Reset", ENETRESET); #else GDFLT2("ENETRESET", "Network_Reset"); #endif #ifdef ENETUNREACH GCST2("ENETUNREACH", "Network_Unreachable", ENETUNREACH); #else GDFLT2("ENETUNREACH", "Network_Unreachable"); #endif #ifdef ENFILE GCST2("ENFILE", "Too_Many_Open_Files_In_System", ENFILE); #else GDFLT2("ENFILE", "Too_Many_Open_Files_In_System"); #endif #ifdef ENOBUFS GCST2("ENOBUFS", "No_Buffer_Space", ENOBUFS); #else GDFLT2("ENOBUFS", "No_Buffer_Space"); #endif #ifdef ENODEV GCST2("ENODEV", "No_Such_Operation_On_Device", ENODEV); #else GDFLT2("ENODEV", "No_Such_Operation_On_Device"); #endif #ifdef ENOENT GCST2("ENOENT", "No_Such_File_Or_Directory", ENOENT); #else GDFLT2("ENOENT", "No_Such_File_Or_Directory"); #endif #ifdef ENOPROTOOPT GCST2("ENOPROTOOPT", "Unknown_Protocol_Option", ENOPROTOOPT); #else GDFLT2("ENOPROTOOPT", "Unknown_Protocol_Option"); #endif #ifdef ENOEXEC GCST2("ENOEXEC", "Exec_Format_Error", ENOEXEC); #else GDFLT2("ENOEXEC", "Exec_Format_Error"); #endif #ifdef ENOLCK GCST2("ENOLCK", "No_Locks_Available", ENOLCK); #else GDFLT2("ENOLCK", "No_Locks_Available"); #endif #ifdef ENOMEM GCST2("ENOMEM", "Not_Enough_Space", ENOMEM); #else GDFLT2("ENOMEM", "Not_Enough_Space"); #endif #ifdef ENOSPC GCST2("ENOSPC", "No_Space_Left_On_Device", ENOSPC); #else GDFLT2("ENOSPC", "No_Space_Left_On_Device"); #endif #ifdef ENOTCONN GCST2("ENOTCONN", "Not_Connected", ENOTCONN); #else GDFLT2("ENOTCONN", "Not_Connected"); #endif #ifdef ENOTSOCK GCST2("ENOTSOCK", "Not_A_Socket", ENOTSOCK); #else GDFLT2("ENOTSOCK", "Not_A_Socket"); #endif #ifdef ENOTSUP GCST2("ENOTSUP", "Operation_Not_Supported", ENOTSUP); #else NON_SUPPORT_MESSAGE("ENOTSUP"); GCST2("ENOTSUP", "Operation_Not_Supported", ENOSYS); #endif #ifdef ENOTDIR GCST2("ENOTDIR", "Not_A_Directory", ENOTDIR); #else GDFLT2("ENOTDIR", "Not_A_Directory"); #endif #ifdef ENOTEMPTY GCST2("ENOTEMPTY", "Directory_Not_Empty", ENOTEMPTY); #else GDFLT2("ENOTEMPTY", "Directory_Not_Empty"); #endif #ifdef ENOSYS GCST2("ENOSYS", "Operation_Not_Implemented", ENOSYS); #else GDFLT2("ENOSYS", "Operation_Not_Supported"); #endif #ifdef ENOTTY GCST2("ENOTTY", "Inappropriate_IO_Control_Operation", ENOTTY); #else GDFLT2("ENOTTY", "Inappropriate_IO_Control_Operation"); #endif #ifdef ENXIO GCST2("ENXIO", "No_Such_Device_Or_Address", ENXIO); #else GDFLT2("ENXIO", "No_Such_Device_Or_Address"); #endif #ifdef EOPNOTSUPP GCST2("EOPNOTSUPP", "Option_Not_Supported", EOPNOTSUPP); #else GDFLT2("EOPNOTSUPP", "Option_Not_Supported"); #endif #ifdef EPERM GCST2("EPERM", "Operation_Not_Permitted", EPERM); #else GDFLT2("EPERM", "Operation_Not_Permitted"); #endif #ifdef EPIPE GCST2("EPIPE", "Broken_Pipe", EPIPE); #else GDFLT2("EPIPE", "Broken_Pipe"); #endif #ifdef EPROTONOSUPPORT GCST2("EPROTONOSUPPORT", "Protocol_Not_Supported", EPROTONOSUPPORT); #else GDFLT2("EPROTONOSUPPORT", "Protocol_Not_Supported"); #endif #ifdef EPROTOTYPE GCST2("EPROTOTYPE", "Wrong_Protocol_Type", EPROTOTYPE); #else GDFLT2("EPROTOTYPE", "Wrong_Protocol_Type"); #endif /* .... what is ERANGE? .... */ #ifdef ERANGE GCST2("ERANGE", "TBD2", ERANGE); #else GDFLT2("ERANGE", "TBD2"); #endif #ifdef EROFS GCST2("EROFS", "Read_Only_File_System", EROFS); #else GDFLT2("EROFS", "Read_Only_File_System"); #endif #ifdef ESOCKTNOSUPPORT GCST2("ESOCKTNOSUPPORT", "Socket_Not_Supported", ESOCKTNOSUPPORT); #else GDFLT2("ESOCKTNOSUPPORT", "Socket_Not_Supported"); #endif #ifdef ESPIPE GCST2("ESPIPE", "Invalid_Seek", ESPIPE); #else GDFLT2("ESPIPE", "Invalid_Seek"); #endif #ifdef ESRCH GCST2("ESRCH", "No_Such_Process", ESRCH); #else GDFLT2("ESRCH", "No_Such_Process"); #endif #ifdef ETIMEDOUT GCST2("ETIMEDOUT", "Timed_Out", ETIMEDOUT); #else GDFLT2("ETIMEDOUT", "Timed_Out"); #endif #ifdef EWOULDBLOCK GCST2("EWOULDBLOCK", "Would_Block", EWOULDBLOCK); #else GDFLT2("EWOULDBLOCK", "Would_Block"); #endif #ifdef EXDEV GCST2("EXDEV", "Improper_Link", EXDEV); #else GDFLT2("EXDEV", "Improper_Link"); #endif #ifdef HOST_NOT_FOUND GCST("Host_Not_Found", HOST_NOT_FOUND); #else GDFLT("Host_Not_Found", -1); #endif #ifdef NO_DATA GCST2("NO_DATA", "No_Address_Available", NO_DATA); #else GDFLT2("NO_DATA", "No_Address_Available"); #endif #ifdef NO_RECOVERY GCST2("NO_RECOVERY", "Unrecoverable_Error", NO_RECOVERY); #else GDFLT2("NO_RECOVERY", "Unrecoverable_Error"); #endif max_posix_error = max_GCST2; EAI_Error_First = 10000; /* Start with a bias of 10000 */ while (1) { if (EAI_Error_First > max_posix_error) { break; } else { EAI_Error_First = EAI_Error_First * 10; } /* end if */ } /* end while */ max_GCST2 = EAI_Error_First; #ifdef EAI_ADDRFAMILY GCST2("EAI_ADDRFAMILY", "Unknown_Address_Type", EAI_ADDRFAMILY+EAI_Error_First); #else GDFLT2("EAI_ADDRFAMILY", "Unknown_Address_Type"); #endif #ifdef EAI_AGAIN GCST2("EAI_AGAIN", "Try_Again", EAI_AGAIN+EAI_Error_First); #else GDFLT2("EAI_AGAIN", "Try_Again"); #endif #ifdef EAI_BADFLAGS GCST2("EAI_BADFLAGS", "Invalid_Flags", EAI_BADFLAGS+EAI_Error_First); #else GDFLT2("EAI_BADFLAGS", "Invalid_Flags"); #endif #ifdef EAI_FAIL GCST2("EAI_FAIL", "Name_Failed", EAI_FAIL+EAI_Error_First); #else GDFLT2("EAI_FAIL", "Name_Failed"); #endif #ifdef EAI_FAMILY GCST2("EAI_FAMILY", "Unknown_Protocol_Family", EAI_FAMILY+EAI_Error_First); #else GDFLT2("EAI_FAMILY", "Unknown_Protocol_Family"); #endif #ifdef EAI_MEMORY GCST2("EAI_MEMORY", "Memory_Allocation_Failed", EAI_MEMORY+EAI_Error_First); #else GDFLT2("EAI_MEMORY", "Memory_Allocation_Failed"); #endif #ifdef EAI_NODATA GCST2("EAI_NODATA", "No_Address_For_Name", EAI_NODATA+EAI_Error_First); #else GDFLT2("EAI_NODATA", "No_Address_For_Name"); #endif #ifdef EAI_NONAME GCST2("EAI_NONAME", "Name_Not_Known", EAI_NONAME+EAI_Error_First); #else GDFLT2("EAI_NONAME", "Name_Not_Known"); #endif #ifdef EAI_SERVICE GCST2("EAI_SERVICE", "Service_Not_Supported", EAI_SERVICE+EAI_Error_First); #else GDFLT2("EAI_SERVICE", "Service_Not_Supported"); #endif #ifdef EAI_SOCKTYPE GCST2("EAI_SOCKTYPE", "Unknown_Socket_Type", EAI_SOCKTYPE+EAI_Error_First); #else GDFLT2("EAI_SOCKTYPE", "Unknown_Socket_Type"); #endif EAI_Error_Last = max_GCST2; XTI_Error_First = 100000; /* Start with a bias of 100000 */ while (1) { if (XTI_Error_First > max_posix_error) { break; } else { XTI_Error_First = XTI_Error_First * 10; } /* end if */ } /* end while */ ifprintf(fp," subtype Addrinfo_Error_Code is Error_Code\n"); ifprintf(fp," range %d .. %d;\n", EAI_Error_First, EAI_Error_Last); max_GCST2 = XTI_Error_First; #ifdef TACCES GCST2("TACCES", "Insufficient_Permission", TACCES+XTI_Error_First); #else GDFLT2("TACCES", "Insufficient_Permission"); #endif #ifdef TADDRBUSY GCST2("TADDRBUSY", "XTI_Address_In_Use", TADDRBUSY+XTI_Error_First); #else GDFLT2("TADDRBUSY", "XTI_Address_In_Use"); #endif #ifdef TBADADDR GCST2("TBADADDR", "Incorrect_Address_Format", TBADADDR+XTI_Error_First); #else GDFLT2("TBADADDR", "Incorrect_Address_Format"); #endif #ifdef TBADDATA GCST2("TBADDATA", "Illegal_Data_Range", TBADDATA+XTI_Error_First); #else GDFLT2("TBADDATA", "Illegal_Data_Range"); #endif #ifdef TBADF GCST2("TBADF", "Invalid_File_Descriptor", TBADF+XTI_Error_First); #else GDFLT2("TBADF", "Invalid_File_Descriptor"); #endif #ifdef TBADFLAG GCST2("TBADFLAG", "Invalid_Flag", TBADFLAG+XTI_Error_First); #else GDFLT2("TBADFLAG", "Invalid_Flag"); #endif #ifdef TBADNAME GCST2("TBADNAME", "Invalid_Communications_Provider", TBADNAME+XTI_Error_First); #else GDFLT2("TBADNAME", "Invalid_Communications_Provider"); #endif #ifdef TBADOPT GCST2("TBADOPT", "Incorrect_Or_Illegal_Option", TBADOPT+XTI_Error_First); #else GDFLT2("TBADOPT", "Incorrect_Or_Illegal_Option"); #endif #ifdef TBADQLEN GCST2("TBADQLEN", "Endpoint_Queue_Length_Is_Zero", TBADQLEN+XTI_Error_First); #else GDFLT2("TBADQLEN", "Endpoint_Queue_Length_Is_Zero"); #endif #ifdef TBADSEQ GCST2("TBADSEQ", "Invalid_Sequence_Number", TBADSEQ+XTI_Error_First); #else GDFLT2("TBADSEQ", "Invalid_Sequence_Number"); #endif #ifdef TBUFOVFLW GCST2("TBUFOVFLW", "Buffer_Not_Large_Enough", TBUFOVFLW+XTI_Error_First); #else GDFLT2("TBUFOVFLW", "Buffer_Not_Large_Enough"); #endif #ifdef TFLOW GCST2("TFLOW", "Flow_Control_Error", TFLOW+XTI_Error_First); #else GDFLT2("TFLOW", "Flow_Control_Error"); #endif #ifdef TINDOUT GCST2("TINDOUT", "Outstanding_Connection_Indications", TINDOUT+XTI_Error_First); #else GDFLT2("TINDOUT", "Outstanding_Connection_Indications"); #endif #ifdef TLOOK GCST2("TLOOK", "Event_Requires_Attention", TLOOK+XTI_Error_First); #else GDFLT2("TLOOK", "Event_Requires_Attention"); #endif #ifdef TNOADDR GCST2("TNOADDR", "Could_Not_Allocate_Address", TNOADDR+XTI_Error_First); #else GDFLT2("TNOADDR", "Could_Not_Allocate_Address"); #endif #ifdef TNODATA GCST2("TNODATA", "No_Data_Available", TNODATA+XTI_Error_First); #else GDFLT2("TNODATA", "No_Data_Available"); #endif #ifdef TNODIS GCST2("TNODIS", "No_Disconnect_Indication_On_Endpoint", TNODIS+XTI_Error_First); #else GDFLT2("TNODIS", "No_Disconnect_Indication_On_Endpoint"); #endif #ifdef TPROVMISMATCH GCST2("TPROVMISMATCH", "Communications_Provider_Mismatch", TPROVMISMATCH+XTI_Error_First); #else GDFLT2("TPROVMISMATCH", "Communications_Provider_Mismatch"); #endif #ifdef TNOREL GCST2("TNOREL", "No_Orderly_Release_Indication_On_Endpoint", TNOREL+XTI_Error_First); #else GDFLT2("TNOREL", "No_Orderly_Release_Indication_On_Endpoint"); #endif #ifdef TNOSTRUCTYPE GCST2("TNOSTRUCTYPE", "Unsupported_Object_Type_Requested", TNOSTRUCTYPE+XTI_Error_First); #else GDFLT2("TNOSTRUCTYPE", "Unsupported_Object_Type_Requested"); #endif #ifdef TNOTSUPPORT GCST2("TNOTSUPPORT", "Function_Not_Supported", TNOTSUPPORT+XTI_Error_First); #else GDFLT2("TNOTSUPPORT", "Function_Not_Supported"); #endif #ifdef TNOUDERR GCST2("TNOUDERR", "No_Unitdata_Error_On_Endpoint", TNOUDERR+XTI_Error_First); #else GDFLT2("TNOUDERR", "No_Unitdata_Error_On_Endpoint"); #endif #ifdef TOUTSTATE GCST2("TOUTSTATE", "Function_Not_Valid_For_State", TOUTSTATE+XTI_Error_First); #else GDFLT2("TOUTSTATE", "Function_Not_Valid_For_State"); #endif #ifdef TPROTO GCST2("TPROTO", "Protocol_Error", TPROTO+XTI_Error_First); #else GDFLT2("TPROTO", "Protocol_Error"); #endif #ifdef TQFULL GCST2("TQFULL", "Endpoint_Queue_Full", TQFULL+XTI_Error_First); #else GDFLT2("TQFULL", "Endpoint_Queue_Full"); #endif #ifdef TSTATECHNG GCST2("TSTATECHNG", "State_Change_In_Progress", TSTATECHNG+XTI_Error_First); #else GDFLT2("TSTATECHNG", "State_Change_In_Progress"); #endif #ifdef TRESADDR GCST2("TRESADDR", "Surrogate_File_Descriptor_Mismatch", TRESADDR+XTI_Error_First); #else GDFLT2("TRESADDR", "Surrogate_File_Descriptor_Mismatch"); #endif #ifdef TRESQLEN GCST2("TRESQLEN", "Incorrect_Surrogate_Queue_Length", TRESQLEN+XTI_Error_First); #else GDFLT2("TRESQLEN", "Incorrect_Surrogate_Queue_Length"); #endif XTI_Error_Last = max_GCST2; ifprintf(fp," subtype XTI_Error_Code is Error_Code\n"); ifprintf(fp," range %d .. %d;\n", XTI_Error_First, XTI_Error_Last); ifprintf(fp," -- System Identification\n"); ifprintf(fp," function System_Name return POSIX_String;\n"); ifprintf(fp," function Node_Name return POSIX_String;\n"); ifprintf(fp," function Release return POSIX_String;\n"); ifprintf(fp," function Version return POSIX_String;\n"); ifprintf(fp," function Machine return POSIX_String;\n"); ifprintf(fp," type Seconds is new Integer;\n"); ifprintf(fp," type Minutes is new Integer;\n"); ifprintf(fp," type Nanoseconds_Base is new Integer;\n"); ifprintf(fp," subtype Nanoseconds is "); ifprintf(fp,"Nanoseconds_Base range 0 .. (10**9) - 1;\n"); ifprintf(fp," type Timespec is private;\n"); ifprintf(fp," function Get_Seconds (Time : Timespec) return Seconds;\n"); ifprintf(fp," procedure Set_Seconds\n"); ifprintf(fp," (Time : in out Timespec;\n"); ifprintf(fp," S : Seconds);\n"); ifprintf(fp," function Get_Nanoseconds (Time : Timespec) "); ifprintf(fp,"return Nanoseconds;\n"); ifprintf(fp," procedure Set_Nanoseconds\n"); ifprintf(fp," (Time : in out Timespec;\n"); ifprintf(fp," NS : Nanoseconds);\n"); ifprintf(fp," procedure Split\n"); ifprintf(fp," (Time : Timespec;\n"); ifprintf(fp," S : out Seconds;\n"); ifprintf(fp," NS : out Nanoseconds);\n"); ifprintf(fp," function To_Timespec\n"); ifprintf(fp," (S : Seconds;\n"); ifprintf(fp," NS : Nanoseconds) return Timespec;\n"); ifprintf(fp," function \"+\" (Left, Right : Timespec) return Timespec;\n"); ifprintf(fp," function \"+\" (Left : Timespec; Right : Nanoseconds)\n"); ifprintf(fp," return Timespec;\n"); ifprintf(fp," function \"-\" (Right : Timespec) return Timespec;\n"); ifprintf(fp," function \"-\" (Left, Right : Timespec) return Timespec;\n"); ifprintf(fp," function \"-\" (Left : Timespec; Right : Nanoseconds)\n"); ifprintf(fp," return Timespec;\n"); ifprintf(fp," function \"*\" (Left : Timespec; Right : Integer)\n"); ifprintf(fp," return Timespec;\n"); ifprintf(fp," function \"*\" (Left : Integer; Right : Timespec)\n"); ifprintf(fp," return Timespec;\n"); ifprintf(fp," function \"/\" (Left : Timespec; Right : Integer)\n"); ifprintf(fp," return Timespec;\n"); ifprintf(fp," function \"/\" (Left, Right : Timespec) return Integer;\n"); ifprintf(fp," function \"<\" (Left, Right : Timespec) return Boolean;\n"); ifprintf(fp," function \"<=\" (Left, Right : Timespec) return Boolean;\n"); ifprintf(fp," function \">\" (Left, Right : Timespec) return Boolean;\n"); ifprintf(fp," function \">=\" (Left, Right : Timespec) return Boolean;\n"); ifprintf(fp," function To_Duration (Time : Timespec) return Duration;\n"); ifprintf(fp," -- pragma Inline (To_Duration);\n"); ifprintf(fp," function To_Timespec (D : Duration) return Timespec;\n"); ifprintf(fp," -- pragma Inline (To_Timespec);\n"); ghdrcmnt("Host-Network Byte Order Conversions"); /* we need 32-bit and a 16-bit unsigned integer types */ if (sizeof (unsigned int) == 4) { if (sizeof (unsigned short) == 2) { /* uint32_t -> unsigned int uint16_t -> unsigned int */ union { unsigned int l; unsigned char c[4]; } x; x.c[0] = 0; x.c[1] = 1; x.c[2] = 2; x.c[3] = 3; if (x.l == 0x00010203) { network_byte_order = 1; ifprintf(fp," Host_Byte_Order_Is_Net_Byte_Order" " : Boolean := True;\n\n"); } else { network_byte_order = 0; ifprintf(fp," Host_Byte_Order_Is_Net_Byte_Order" " : Boolean := False;\n\n"); } } else quit ("short is not 16-bit",""); } else quit ("int is not 32-bit",""); ifprintf(fp," function Host_To_Network_Byte_Order"); ifprintf(fp," (Host_32 : Interfaces.Unsigned_32)\n"); ifprintf(fp," return Interfaces.Unsigned_32;\n"); ifprintf(fp," function Host_To_Network_Byte_Order"); ifprintf(fp," (Host_16 : Interfaces.Unsigned_16)\n"); ifprintf(fp," return Interfaces.Unsigned_16;\n"); ifprintf(fp," function Network_To_Host_Byte_Order"); ifprintf(fp," (Host_32 : Interfaces.Unsigned_32)\n"); ifprintf(fp," return Interfaces.Unsigned_32;\n"); ifprintf(fp," function Network_To_Host_Byte_Order"); ifprintf(fp," (Host_16 : Interfaces.Unsigned_16)\n"); ifprintf(fp," return Interfaces.Unsigned_16;\n"); ifprintf(fp," XTI_Blocking_Behavior : constant Blocking_Behavior\n"); ifprintf(fp," := Tasks;\n"); ifprintf(fp," Sockets_Blocking_Behavior :" " constant Blocking_Behavior\n"); ifprintf(fp," := Tasks;\n"); ghdrcmnt("Octet declarations"); ifprintf(fp," type Octet is mod 2 ** 8;\n"); ifprintf(fp," type Octet_Array is\n"); ifprintf(fp," array (Integer range <>) of aliased Octet;\n"); ifprintf(fp," type Octet_Array_Pointer is access all Octet_Array;\n"); ifprintf(fp,"private\n"); #ifdef VERSION ifprintf(fp," Florist_Version : constant String := \""VERSION"\";\n\n"); #endif ifprintf(fp," type String_List;\n"); ifprintf(fp," -- See package body for comments on String_List.\n"); ifprintf(fp," type POSIX_String_List is access all String_List;\n"); ifprintf(fp," pragma No_Strict_Aliasing (POSIX_String_List);\n"); ifprintf(fp," Empty_String_List : constant POSIX_String_List" " := null;\n\n"); ifprintf(fp," type Timespec is record\n"); ifprintf(fp," Val : Duration := 0.0;\n"); ifprintf(fp," end record;\n"); ifprintf(fp," -- The value is of type Duration because we can do more\n"); ifprintf(fp," -- efficient arithmetic on that type "); ifprintf(fp,"than on a two-part C struct.\n"); ifprintf(fp," -- We rely that GNAT implements type "); ifprintf(fp,"Duration with enough\n"); ifprintf(fp," -- precision (64 bits) to hold a full C timespec value.\n"); ifprintf(fp," -- The enclosing record is to permit "); ifprintf(fp,"implicit initialization.\n"); guitp("Bits", sizeof(int)); ifprintf(fp," -- Bits and the C int type are always the same size.\n"); ifprintf(fp," -- We don't define int here," " since we want to be able to\n"); ifprintf(fp," -- use it in the visible parts of child packages.\n\n"); ifprintf(fp," type Option_Set is\n"); ifprintf(fp," record\n"); ifprintf(fp," Option : Bits := 0;\n"); ifprintf(fp," end record;\n"); { int i; for (i=1; i<32; i++) { ifprintf(fp," Option_%d : constant Option_Set" " := (Option => 2**%d);\n", i, i-1); } } ifprintf(fp,"end POSIX;\n"); fclose (fp); fprintf(stderr,"done generating posix.ads\n"); } /* create_c -------- create package POSIX.C, in file posix-c.ads */ void create_c() { fprintf(stderr,"creating package POSIX.C\n"); if (! (fp = fopen (GENDIR "/posix-c.ads", "w"))) { perror ("posix-c.ads"); quit("can't open file to write",""); } gheader("POSIX.C", FSU_Header); ifprintf(fp,"with System; use System;\n"); ifprintf(fp,"with Unchecked_Conversion;\n"); ifprintf(fp,"package POSIX.C is\n"); ifprintf(fp," pragma Elaborate_Body;\n"); ifprintf(fp," -- ========= --\n"); ifprintf(fp," -- WARNING --\n"); ifprintf(fp," -- ========= --\n\n"); ifprintf(fp," -- This package should NOT be used directly"); ifprintf(fp," by an application.\n"); ifprintf(fp," -- It is internal to the FLORIST implementation of the"); ifprintf(fp," POSIX.5 API,\n"); ifprintf(fp," -- and may be changed or replaced in future versions"); ifprintf(fp," of FLORIST.\n\n"); ifprintf(fp," ALIGNMENT : constant"); ifprintf(fp," := Natural'Min (Standard'Maximum_Alignment, 8);\n"); ifprintf(fp," -- worst-case alignment requirement\n"); /* numeric types ------------- */ ghdrcmnt("basic C types"); gsitp("short", sizeof(short)); gsitp("int", sizeof(int)); gptrtp("int","int"); guitp("unsigned", sizeof(unsigned)); gsitp("long", sizeof(long)); guitp("unsigned_long", sizeof(unsigned long)); guitp("unsigned_int", sizeof(unsigned int)); guitp("unsigned_short", sizeof(unsigned short)); guitp("caddr_t", sizeof(caddr_t)); g_size_t(); g_time_t(); g_clock_t(); gsitp("ptr_as_int", sizeof(char *)); /* char * and char ** ------------------ */ ifprintf(fp," subtype char is POSIX_Character;\n"); gptrtp("char","char"); gen_unchckd_conv("To_Ptr", "Address", "char_ptr"); gen_renaming("function To_char_ptr (Addr : Address) return char_ptr", "To_Ptr"); gen_unchckd_conv("To_Address", "char_ptr", "Address"); gptrtp("char_ptr","char_ptr"); gen_unchckd_conv("To_Ptr", "Address", "char_ptr_ptr"); gen_unchckd_conv("To_Address", "char_ptr_ptr", "Address"); ifprintf(fp," type char_ptr_array is\n"); ifprintf(fp," array (Positive range <>) of aliased char_ptr;\n"); ifprintf(fp," function malloc (size : size_t) return char_ptr;\n"); ifprintf(fp," function malloc (size : size_t) return char_ptr_ptr;\n"); ifprintf(fp," pragma Import (C, malloc, \"malloc\");\n"); ifprintf(fp," procedure free (object : char_ptr);\n"); ifprintf(fp," procedure free (object : char_ptr_ptr);\n"); ifprintf(fp," pragma Import (C, free, \"free\");\n"); ifprintf(fp," procedure Advance (Ptr : in out char_ptr);\n"); ifprintf(fp," procedure Advance (Ptr : in out char_ptr_ptr);\n"); ifprintf(fp," -- advance Ptr to next location\n"); ifprintf(fp," -- pragma Inline (Advance);\n"); ifprintf(fp," function Form_POSIX_String (Str : char_ptr)\n"); ifprintf(fp," return POSIX_String;\n"); ifprintf(fp," -- makes new copy of string, without null terminator\n"); /* constants --------- */ ghdrcmnt("constants"); #ifdef AIO_ALLDONE GCST("AIO_ALLDONE", AIO_ALLDONE); #else GDFLT("AIO_ALLDONE", 0); #endif #ifdef AIO_CANCELED GCST("AIO_CANCELED", AIO_CANCELED); #else GDFLT("AIO_CANCELED", 0); #endif #ifdef AIO_NOTCANCELED GCST("AIO_NOTCANCELED", AIO_NOTCANCELED); #else GDFLT("AIO_NOTCANCELED", 0); #endif #ifdef B0 GCST("B0", B0); #else GDFLT("B0", 0); #endif #ifdef B110 GCST("B110", B110); #else GDFLT("B110", 0); #endif #ifdef B115200 GCST("B115200", B115200); #else GDFLT("B115200", 0); #endif #ifdef B1200 GCST("B1200",B1200); #else GDFLT("B1200", 0); #endif #ifdef B134 GCST("B134", B134); #else GDFLT("B134", 0); #endif #ifdef B150 GCST("B150", B150); #else GDFLT("B150", 0); #endif #ifdef B1800 GCST("B1800", B1800); #else GDFLT("B1800", 0); #endif #ifdef B19200 GCST("B19200", B19200); #else GDFLT("B19200", 0); #endif #ifdef B200 GCST("B200", B200); #else GDFLT("B200", 0); #endif #ifdef B230400 GCST("B230400", B230400); #else GDFLT("B230400", 0); #endif #ifdef B2400 GCST("B2400", B2400); #else GDFLT("B2400", 0); #endif #ifdef B300 GCST("B300", B300); #else GDFLT("B300", 0); #endif #ifdef B38400 GCST("B38400", B38400); #else GDFLT("B38400", 0); #endif #ifdef B460800 GCST("B460800", B460800); #else GDFLT("B460800", 0); #endif #ifdef B4800 GCST("B4800", B4800); #else GDFLT("B4800", 0); #endif #ifdef B50 GCST("B50", B50); #else GDFLT("B50", 0); #endif #ifdef B57600 GCST("B57600", B57600); #else GDFLT("B57600", 0); #endif #ifdef B600 GCST("B600", B600); #else GDFLT("B600", 0); #endif #ifdef B75 GCST("B75", B75); #else GDFLT("B75", 0); #endif #ifdef B9600 GCST("B9600", B9600); #else GDFLT("B9600", 0); #endif #ifdef BRKINT GCST("BRKINT", BRKINT); #else GDFLT("BRKINT", 0); #endif #ifdef CLK_TCK GCST("CLK_TCK", CLK_TCK); #else GDFLT("CLK_TCK", 0); #endif #ifdef CLOCAL GCST("CLOCAL", CLOCAL); #else GDFLT("CLOCAL", 0); #endif #ifdef CLOCK_REALTIME GCST("CLOCK_REALTIME", CLOCK_REALTIME); #else GDFLT("CLOCK_REALTIME", 1); #endif #ifdef CLOCK_SGI_FAST GCST("CLOCK_SGI_FAST", CLOCK_SGI_FAST); #endif #ifdef CREAD GCST("CREAD", CREAD); #else GDFLT("CREAD", 0); #endif #ifdef CSIZE GCST("CSIZE", CSIZE); #else GDFLT("CSIZE", 0); #endif #ifdef CSTOPB GCST("CSTOPB", CSTOPB); #else GDFLT("CSTOPB", 0); #endif #ifdef CS5 GCST("CS5", CS5); #else GDFLT("CS5", 0); #endif #ifdef CS6 GCST("CS6", CS6); #else GDFLT("CS6", 0); #endif #ifdef CS7 GCST("CS7", CS7); #else GDFLT("CS7", 0); #endif #ifdef CS8 GCST("CS8", CS8); #else GDFLT("CS8", 0); #endif ifprintf(fp," -- error code constants are in posix.ads\n"); #ifdef ECHO GCST("ECHO", ECHO); #else GDFLT("ECHO", 0); #endif #ifdef ECHOE GCST("ECHOE", ECHOE); #else GDFLT("ECHOE", 0); #endif #ifdef ECHOK GCST("ECHOK", ECHOK); #else GDFLT("ECHOK", 0); #endif #ifdef ECHONL GCST("ECHONL", ECHONL); #else GDFLT("ECHONL", 0); #endif #ifdef FD_CLOEXEC GCST("FD_CLOEXEC", FD_CLOEXEC); #else GDFLT("FD_CLOEXEC", 0); #endif #ifdef F_DUPFD GCST("F_DUPFD", F_DUPFD); #else GDFLT("F_DUPFD", 0); #endif #ifdef F_GETFD GCST("F_GETFD", F_GETFD); #else GDFLT("F_GETFD", 0); #endif #ifdef F_GETFL GCST("F_GETFL", F_GETFL); #else GDFLT("F_GETFL", 0); #endif #ifdef F_GETLK GCST("F_GETLK", F_GETLK); #else GDFLT("F_GETLK", 0); #endif #ifdef F_OK GCST("F_OK", F_OK); #else GDFLT("F_OK", 0); #endif #ifdef F_RDLCK GCST("F_RDLCK", F_RDLCK); #else GDFLT("F_RDLCK", 0); #endif #ifdef F_SETFD GCST("F_SETFD", F_SETFD); #else GDFLT("F_SETFD", 0); #endif #ifdef F_SETFL GCST("F_SETFL", F_SETFL); #else GDFLT("F_SETFL", 0); #endif #ifdef F_SETLK GCST("F_SETLK", F_SETLK); #else GDFLT("F_SETLK", 0); #endif #ifdef F_SETLKW GCST("F_SETLKW", F_SETLKW); #else GDFLT("F_SETLKW", 0); #endif #ifdef F_UNLCK GCST("F_UNLCK", F_UNLCK); #else GDFLT("F_UNLCK", 0); #endif #ifdef F_WRLCK GCST("F_WRLCK", F_WRLCK); #else GDFLT("F_WRLCK", 0); #endif #ifdef HUPCL GCST("HUPCL", HUPCL); #else GDFLT("HUPCL", 0); #endif #ifdef ICANON GCST("ICANON", ICANON); #else GDFLT("ICANON", 0); #endif #ifdef ICRNL GCST("ICRNL", ICRNL); #else GDFLT("ICRNL", 0); #endif #ifdef IEXTEN GUCST("IEXTEN", IEXTEN); #else GDFLT("IEXTEN", 0); #endif #ifdef IGNBRK GCST("IGNBRK", IGNBRK); #else GDFLT("IGNBRK", 0); #endif #ifdef IGNCR GCST("IGNCR", IGNCR); #else GDFLT("IGNCR", 0); #endif #ifdef IGNPAR GCST("IGNPAR", IGNPAR); #else GDFLT("IGNPAR", 0); #endif #ifdef INLCR GCST("INLCR", INLCR); #else GDFLT("INLCR", 0); #endif #ifdef INPCK GCST("INPCK", INPCK); #else GDFLT("INPCK", 0); #endif #ifdef ISIG GCST("ISIG", ISIG); #else GDFLT("ISIG", 0); #endif #ifdef ISTRIP GCST("ISTRIP", ISTRIP); #else GDFLT("ISTRIP", 0); #endif #ifdef IXOFF GCST("IXOFF", IXOFF); #else GDFLT("IXOFF", 0); #endif #ifdef IXON GCST("IXON", IXON); #else GDFLT("IXON", 0); #endif #ifdef L_ctermid GCST("L_ctermid", L_ctermid); #else GDFLT("L_ctermid", 10); #endif #ifdef LIO_NOP GCST("LIO_NOP", LIO_NOP); #else GDFLT("LIO_NOP", 0); #endif #ifdef LIO_NOWAIT GCST("LIO_NOWAIT", LIO_NOWAIT); #else GDFLT("LIO_NOWAIT", 0); #endif #ifdef LIO_READ GCST("LIO_READ", LIO_READ); #else GDFLT("LIO_READ", 0); #endif #ifdef LIO_WAIT GCST("LIO_WAIT", LIO_WAIT); #else GDFLT("LIO_WAIT", 0); #endif #ifdef LIO_WRITE GCST("LIO_WRITE", LIO_WRITE); #else GDFLT("LIO_WRITE", 0); #endif #ifdef MAP_FAILED GCST("MAP_FAILED", MAP_FAILED); #else GDFLT("MAP_FAILED",-1); #endif /* Linux wants MAP_FILE flag if we are memory-mapping a file. We define it to be zero for other systems. */ #ifdef MAP_FILE GCST("MAP_FILE", MAP_FILE); #else GDFLT("MAP_FILE", 0); #endif #ifdef MAP_FIXED GCST("MAP_FIXED", MAP_FIXED); #else GDFLT("MAP_FIXED", 0); #endif #ifdef MAP_VARIABLE GCST("MAP_VARIABLE", MAP_VARIABLE); #else GDFLT("MAP_VARIABLE", 0); #endif #ifdef MAP_PRIVATE GCST("MAP_PRIVATE", MAP_PRIVATE); #else GDFLT("MAP_PRIVATE", 0); #endif #ifdef MAP_SHARED GCST("MAP_SHARED", MAP_SHARED); #else GDFLT("MAP_SHARED", 0); #endif #ifdef MAX_CANON GCST("MAX_CANON", MAX_CANON); #else GDFLT("MAX_CANON", 0); #endif #ifdef MAX_INPUT GCST("MAX_INPUT", MAX_INPUT); #else GDFLT("MAX_INPUT", 0); #endif #ifdef MCL_CURRENT GCST("MCL_CURRENT", MCL_CURRENT); #else GDFLT("MCL_CURRENT", 0); #endif #ifdef MCL_FUTURE GCST("MCL_FUTURE", MCL_FUTURE); #else GDFLT("MCL_FUTURE", 0); #endif #ifdef MS_ASYNC GCST("MS_ASYNC", MS_ASYNC); #else GDFLT("MS_ASYNC", 0); #endif #ifdef MS_INVALIDATE GCST("MS_INVALIDATE", MS_INVALIDATE); #else GDFLT("MS_INVALIDATE", 0); #endif #ifdef MS_SYNC GCST("MS_SYNC", MS_SYNC); #else GDFLT("MS_SYNC", 0); #endif #ifdef MS_EINTR GCST("MS_EINTR", MS_EINTR); #else GDFLT("MS_EINTR", 0); #endif #ifdef NCCS GCST("NCCS", NCCS); #else GDFLT("NCCS", 0); #endif #ifdef NOFLSH GUCST("NOFLSH", NOFLSH); #else GDFLT("NOFLSH", 0); #endif #ifdef OPOST GCST("OPOST", OPOST); #else GDFLT("OPOST", 0); #endif #ifdef O_ACCMODE GCST("O_ACCMODE", O_ACCMODE); #else GDFLT("O_ACCMODE", 0); #endif #ifdef O_APPEND GCST("O_APPEND", O_APPEND); #else GDFLT("O_APPEND", 0); #endif #ifdef O_CREAT GCST("O_CREAT", O_CREAT); #else GDFLT("O_CREAT", 0); #endif #ifdef O_DSYNC GCST("O_DSYNC", O_DSYNC); #else GDFLT("O_DSYNC", 0); #endif #ifdef O_EXCL GCST("O_EXCL", O_EXCL); #else GDFLT("O_EXCL", 0); #endif #ifdef O_NOCTTY GCST("O_NOCTTY", O_NOCTTY); #else GDFLT("O_NOCTTY", 0); #endif #ifdef O_NONBLOCK GCST("O_NONBLOCK", O_NONBLOCK); #else GDFLT("O_NONBLOCK", 0); #endif #ifdef O_RDONLY GCST("O_RDONLY", O_RDONLY); #else GDFLT("O_RDONLY", 0); #endif #ifdef O_RDWR GCST("O_RDWR", O_RDWR); #else GDFLT("O_RDWR", 0); #endif #ifdef O_RSYNC GCST("O_RSYNC", O_RSYNC); #else GDFLT("O_RSYNC", 0); #endif #ifdef O_SYNC GCST("O_SYNC", O_SYNC); #else GDFLT("O_SYNC", 0); #endif #ifdef O_TRUNC GCST("O_TRUNC", O_TRUNC); #else GDFLT("O_TRUNC", 0); #endif #ifdef O_WRONLY GCST("O_WRONLY", O_WRONLY); #else GDFLT("O_WRONLY", 0); #endif #ifdef PAGESIZE GCST("PAGESIZE", PAGESIZE); #else #ifdef PAGE_SIZE GCST("PAGESIZE", PAGE_SIZE); #else GDFLT("PAGESIZE", 0); #endif #endif #ifdef PARENB GCST("PARENB", PARENB); #else GDFLT("PARENB", 0); #endif #ifdef PARMRK GCST("PARMRK", PARMRK); #else GDFLT("PARMRK", 0); #endif #ifdef PARODD GCST("PARODD", PARODD); #else GDFLT("PARODD", 0); #endif #ifdef PROT_EXEC GCST("PROT_EXEC", PROT_EXEC); #else GDFLT("PROT_EXEC", 0); #endif #ifdef PROT_NONE GCST("PROT_NONE", PROT_NONE); #else GDFLT("PROT_NONE", 0); #endif #ifdef PROT_READ GCST("PROT_READ", PROT_READ); #else GDFLT("PROT_READ", 0); #endif #ifdef PROT_WRITE GCST("PROT_WRITE", PROT_WRITE); #else GDFLT("PROT_WRITE", 0); #endif #ifdef PTHREAD_DESTRUCTOR_ITERATIONS GCST("PTHREAD_DESTRUCTOR_ITERATIONS", PTHREAD_DESTRUCTOR_ITERATIONS); #else GDFLT("PTHREAD_DESTRUCTOR_ITERATIONS", 0); #endif #ifdef PTHREAD_EXPLICIT_SCHED GCST("PTHREAD_EXPLICIT_SCHED", PTHREAD_EXPLICIT_SCHED); #else GDFLT("PTHREAD_EXPLICIT_SCHED", 0); #endif #ifdef PTHREAD_INHERIT_SCHED GCST("PTHREAD_INHERIT_SCHED", PTHREAD_INHERIT_SCHED); #else GDFLT("PTHREAD_INHERIT_SCHED", 0); #endif #ifdef PTHREAD_PRIO_INHERIT GCST("PTHREAD_PRIO_INHERIT", PTHREAD_PRIO_INHERIT); #else GDFLT("PTHREAD_PRIO_INHERIT", 0); #endif #ifdef PTHREAD_PRIO_NONE GCST("PTHREAD_PRIO_NONE", PTHREAD_PRIO_NONE); #else GDFLT("PTHREAD_PRIO_NONE", 0); #endif #ifdef PTHREAD_PRIO_PROTECT GCST("PTHREAD_PRIO_PROTECT", PTHREAD_PRIO_PROTECT); #else GDFLT("PTHREAD_PRIO_PROTECT", 0); #endif #ifdef PTHREAD_PROCESS_SHARED GCST("PTHREAD_PROCESS_SHARED", PTHREAD_PROCESS_SHARED); GCST("PTHREAD_PROCESS_PRIVATE", PTHREAD_PROCESS_PRIVATE); #else GDFLT("PTHREAD_PROCESS_SHARED", 1); GDFLT("PTHREAD_PROCESS_PRIVATE", 0); #endif #ifdef PTHREAD_SCOPE_PROCESS GCST("PTHREAD_SCOPE_PROCESS", PTHREAD_SCOPE_PROCESS); #else GDFLT("PTHREAD_SCOPE_PROCESS", 0); #endif #ifdef PTHREAD_SCOPE_SYSTEM GCST("PTHREAD_SCOPE_SYSTEM", PTHREAD_SCOPE_SYSTEM); #else GDFLT("PTHREAD_SCOPE_SYSTEM", 0); #endif #ifdef R_OK GCST("R_OK", R_OK); #else GDFLT("R_OK", 0); #endif #ifdef SA_NOCLDSTOP GCST("SA_NOCLDSTOP", SA_NOCLDSTOP); #else GDFLT("SA_NOCLDSTOP", 0); #endif #ifdef SA_SIGINFO GCST("SA_SIGINFO", SA_SIGINFO); #else GDFLT("SA_SIGINFO", 0); #endif #ifdef SCHED_FIFO GCST("SCHED_FIFO", SCHED_FIFO); #else GDFLT("SCHED_FIFO", 0); #endif #ifdef SCHED_OTHER GCST("SCHED_OTHER", SCHED_OTHER); #else GDFLT("SCHED_OTHER", 0); #endif #ifdef SCHED_RR GCST("SCHED_RR", SCHED_RR); #else GDFLT("SCHED_RR", 0); #endif #ifdef SEEK_CUR GCST("SEEK_CUR", SEEK_CUR); #else GDFLT("SEEK_CUR", 0); #endif #ifdef SEEK_END GCST("SEEK_END", SEEK_END); #else GDFLT("SEEK_END", 0); #endif #ifdef SEEK_SET GCST("SEEK_SET", SEEK_SET); #else GDFLT("SEEK_SET", 0); #endif #ifdef SIGABRT GCST("SIGABRT", SIGABRT); #else GDFLT("SIGABRT", 0); #endif #ifdef SIGALRM GCST("SIGALRM", SIGALRM); #else GDFLT("SIGALRM", 0); #endif #ifdef SIGBUS GCST("SIGBUS", SIGBUS); #else GDFLT("SIGBUS", 0); #endif #ifdef SIGCHLD GCST("SIGCHLD", SIGCHLD); #else GDFLT("SIGCHLD", 0); #endif #ifdef SIGCONT GCST("SIGCONT", SIGCONT); #else GDFLT("SIGCONT", 0); #endif #ifdef SIGEV_NONE GCST("SIGEV_NONE", SIGEV_NONE); #else GDFLT("SIGEV_NONE", 100); #endif #ifdef SIGEV_SIGNAL GCST("SIGEV_SIGNAL", SIGEV_SIGNAL); #else GDFLT("SIGEV_SIGNAL", 101); #endif #ifdef SIGEV_THREAD GCST("SIGEV_THREAD", SIGEV_THREAD); #else GDFLT("SIGEV_THREAD", 102); #endif #ifdef SIGFPE GCST("SIGFPE", SIGFPE); #else GDFLT("SIGFPE", 0); #endif #ifdef SIGHUP GCST("SIGHUP", SIGHUP); #else GDFLT("SIGHUP", 0); #endif #ifdef SIGILL GCST("SIGILL", SIGILL); #else GDFLT("SIGILL", 0); #endif #ifdef SIGINT GCST("SIGINT", SIGINT); #else GDFLT("SIGINT", 0); #endif #ifdef SIGIO GCST("SIGIO", SIGIO); #else GDFLT("SIGIO", 0); #endif #ifdef SIGKILL GCST("SIGKILL", SIGKILL); #else GDFLT("SIGKILL", 0); #endif #ifdef SIGPIPE GCST("SIGPIPE", SIGPIPE); #else GDFLT("SIGPIPE", 0); #endif #ifdef SIGQUIT GCST("SIGQUIT", SIGQUIT); #else GDFLT("SIGQUIT", 0); #endif /* Try to find out the range of valid signals. We have not yet discovered a portable C way of doing this. We assume the range starts at 0 and is continuous up to some limit. We need this becuase we want to represent sets of signals as Boolean arrays. We considered using sigset_t directly, and would have liked to do so, but had two problems: (1) sigset_t apparently allows the use of dynamically allocated memory (2) we could not figure out how to check for signal validity; in particular, we needed a way to check for whether a given signal is reserved by the Ada runtime system. */ #if defined(__APPLE__) # define BADSIG 0 #else # define BADSIG (-1) #endif {sigset_t set; int sig; int result; int last_good = -1; int first_bad = -1; sigfillset (&set); for (sig = 0; sig < 1024; sig++) { result = sigismember (&set, sig); if (result == 1) last_good = sig; else if ((result == BADSIG) && (first_bad = -1)) first_bad = sig; } if (last_good == 1023) printf("c-posix: WARNING: signal range estimate probably too small\n"); if (first_bad < last_good) { printf("c-posix: WARNING: signal range estimate may be invalid\n"); last_good = first_bad - 1; } #if defined(__APPLE__) /* On Darwin, the above mechanism fails to make a reasonable guess as to the number of available signals. In the test loop sigismember returns true for every value of sig, including zero, and no first_bad is ever set. For now, hard code a reasonable value. */ last_good = 31; #endif #ifdef SIGRTMAX #ifdef SIGRTMIN if ((SIGRTMAX >= 0) && (SIGRTMIN >= 0)) { if ((SIGRTMAX > last_good)) { GCST("SIGRTMAX", last_good); } else { GCST("SIGRTMAX", SIGRTMAX); } GCST("SIGRTMIN", SIGRTMIN); } else { GDFLT("SIGRTMAX", 0); GDFLT("SIGRTMIN", 1); } #else GDFLT("SIGRTMAX", 0); GDFLT("SIGRTMIN", 1); #endif #else GDFLT("SIGRTMAX", 0); GDFLT("SIGRTMIN", 1); #endif GCST("NSIGS", last_good); } #ifdef SIGSEGV GCST("SIGSEGV", SIGSEGV); #else GDFLT("SIGSEGV", 0); #endif #ifdef SIGSTOP GCST("SIGSTOP", SIGSTOP); #else GDFLT("SIGSTOP", 0); #endif #ifdef SIGTERM GCST("SIGTERM", SIGTERM); #else GDFLT("SIGTERM", 0); #endif #ifdef SIGTRAP GCST("SIGTRAP", SIGTRAP); #else GDFLT("SIGTRAP", 0); #endif #ifdef SIGTSTP GCST("SIGTSTP", SIGTSTP); #else GDFLT("SIGTSTP", 0); #endif #ifdef SIGTTIN GCST("SIGTTIN", SIGTTIN); #else GDFLT("SIGTTIN", 0); #endif #ifdef SIGTTOU GCST("SIGTTOU", SIGTTOU); #else GDFLT("SIGTTOU", 0); #endif #ifdef SIGURG GCST("SIGURG", SIGURG); #else GDFLT("SIGURG", 0); #endif #ifdef SIGUSR1 GCST("SIGUSR1", SIGUSR1); #else GDFLT("SIGUSR1", 0); #endif #ifdef SIGUSR2 GCST("SIGUSR2", SIGUSR2); #else GDFLT("SIGUSR2", 0); #endif #ifdef SIG_BLOCK GCST("SIG_BLOCK", SIG_BLOCK); #else GDFLT("SIG_BLOCK", 0); #endif /* .... hope that nobody is really using a pointer or a nontrivial macro for SIG_IGN or SIG_DFL */ #ifdef SIG_DFL GCST("SIG_DFL", (int) SIG_DFL); #else GDFLT("SIG_DFL", 0); #endif #ifdef SIG_IGN GCST("SIG_IGN", (int) SIG_IGN); #else GDFLT("SIG_IGN", 0); #endif #ifdef SIG_SETMASK GCST("SIG_SETMASK", SIG_SETMASK); #else GDFLT("SIG_SETMASK", 0); #endif #ifdef SIG_UNBLOCK GCST("SIG_UNBLOCK", SIG_UNBLOCK); #else GDFLT("SIG_UNBLOCK", 0); #endif #ifdef SI_ASYNCIO GCST("SI_ASYNCIO", SI_ASYNCIO); #else GDFLT("SI_ASYNCIO", 101); #endif #ifdef SI_MESGQ GCST("SI_MESGQ", SI_MESGQ); #else GDFLT("SI_MESGQ", 102); #endif #ifdef SI_QUEUE GCST("SI_QUEUE", SI_QUEUE); #else GDFLT("SI_QUEUE", 103); #endif #ifdef SI_TIMER GCST("SI_TIMER", SI_TIMER); #else GDFLT("SI_TIMER", 104); #endif #ifdef SI_USER GCST("SI_USER", SI_USER); #else GDFLT("SI_USER", 105); #endif #ifdef S_IFSOCK GCST("S_IFSOCK", S_IFSOCK); #else GDFLT("S_IFSOCK", 0); #endif #ifdef S_IRGRP GCST("S_IRGRP", S_IRGRP); #else GDFLT("S_IRGRP", 0); #endif #ifdef S_IROTH GCST("S_IROTH", S_IROTH); #else GDFLT("S_IROTH", 0); #endif #ifdef S_IRUSR GCST("S_IRUSR", S_IRUSR); #else GDFLT("S_IRUSR", 0); #endif #ifdef S_IRWXG GCST("S_IRWXG", S_IRWXG); #else GDFLT("S_IRWXG", 0); #endif #ifdef S_IRWXO GCST("S_IRWXO", S_IRWXO); #else GDFLT("S_IRWXO", 0); #endif #ifdef S_IRWXU GCST("S_IRWXU", S_IRWXU); #else GDFLT("S_IRWXU", 0); #endif #ifdef S_ISGID GCST("S_ISGID", S_ISGID); #else GDFLT("S_ISGID", 0); #endif #ifdef S_ISUID GCST("S_ISUID", S_ISUID); #else GDFLT("S_ISUID", 0); #endif #ifdef S_IWGRP GCST("S_IWGRP", S_IWGRP); #else GDFLT("S_IWGRP", 0); #endif #ifdef S_IWOTH GCST("S_IWOTH", S_IWOTH); #else GDFLT("S_IWOTH", 0); #endif #ifdef S_IWUSR GCST("S_IWUSR", S_IWUSR); #else GDFLT("S_IWUSR", 0); #endif #ifdef S_IXGRP GCST("S_IXGRP", S_IXGRP); #else GDFLT("S_IXGRP", 0); #endif #ifdef S_IXOTH GCST("S_IXOTH", S_IXOTH); #else GDFLT("S_IXOTH", 0); #endif #ifdef S_IXUSR GCST("S_IXUSR", S_IXUSR); #else GDFLT("S_IXUSR", 0); #endif #ifdef TCIFLUSH GCST("TCIFLUSH", TCIFLUSH); #else GDFLT("TCIFLUSH", 0); #endif #ifdef TCIOFF GCST("TCIOFF", TCIOFF); #else GDFLT("TCIOFF", 0); #endif #ifdef TCIOFLUSH GCST("TCIOFLUSH", TCIOFLUSH); #else GDFLT("TCIOFLUSH", 0); #endif #ifdef TCION GCST("TCION", TCION); #else GDFLT("TCION", 0); #endif #ifdef TCOFLUSH GCST("TCOFLUSH", TCOFLUSH); #else GDFLT("TCOFLUSH", 0); #endif #ifdef TCOOFF GCST("TCOOFF", TCOOFF); #else GDFLT("TCOOFF", 0); #endif #ifdef TCOON GCST("TCOON", TCOON); #else GDFLT("TCOON", 0); #endif #ifdef TCSADRAIN GCST("TCSADRAIN", TCSADRAIN); #else GDFLT("TCSADRAIN", 0); #endif #ifdef TCSAFLUSH GCST("TCSAFLUSH", TCSAFLUSH); #else GDFLT("TCSAFLUSH", 0); #endif #ifdef TCSANOW GCST("TCSANOW", TCSANOW); #else GDFLT("TCSANOW", 0); #endif #ifdef TIMER_ABSTIME GCST("TIMER_ABSTIME", TIMER_ABSTIME); #else GDFLT("TIMER_ABSTIME", 1); #endif /* TIMER_RELTIME is not defined by the POSIX.1b standard, but seems to be used by at least Solaris; letting the value default to 0 if undefined gives us the same effect as the POSIX.1c specification. */ #ifdef TIMER_RELTIME GCST("TIMER_RELTIME", TIMER_RELTIME); #else GDFLT("TIMER_RELTIME", 0); #endif #ifdef TOSTOP GCST("TOSTOP", TOSTOP); #else GDFLT("TOSTOP", 0); #endif #ifdef VEOF GCST("VEOF", VEOF); #else GDFLT("VEOF", 0); #endif #ifdef VEOL GCST("VEOL", VEOL); #else GDFLT("VEOL", 0); #endif #ifdef VERASE GCST("VERASE", VERASE); #else GDFLT("VERASE", 0); #endif #ifdef VINTR GCST("VINTR", VINTR); #else GDFLT("VINTR", 0); #endif #ifdef VKILL GCST("VKILL", VKILL); #else GDFLT("VKILL", 0); #endif #ifdef VMIN GCST("VMIN", VMIN); #else GDFLT("VMIN", 0); #endif #ifdef VQUIT GCST("VQUIT", VQUIT); #else GDFLT("VQUIT", 0); #endif #ifdef VSTART GCST("VSTART", VSTART); #else GDFLT("VSTART", 0); #endif #ifdef VSTOP GCST("VSTOP", VSTOP); #else GDFLT("VSTOP", 0); #endif #ifdef VSUSP GCST("VSUSP", VSUSP); #else GDFLT("VSUSP", 0); #endif #ifdef VTIME GCST("VTIME", VTIME); #else GDFLT("VTIME", 0); #endif #ifdef WNOHANG GCST("WNOHANG", WNOHANG); #else GDFLT("WNOHANG", 0); #endif #ifdef WUNTRACED GCST("WUNTRACED", WUNTRACED); #else GDFLT("WUNTRACED", 0); #endif #ifdef W_OK GCST("W_OK", W_OK); #else GDFLT("W_OK", 0); #endif #ifdef X_OK GCST("X_OK", X_OK); #else GDFLT("X_OK", 0); #endif #ifdef _PC_ASYNC_IO GCST("PC_ASYNC_IO", _PC_ASYNC_IO); #else GDFLT("PC_ASYNC_IO", 0); #endif #ifdef _PC_CHOWN_RESTRICTED GCST("PC_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED); #else GDFLT("PC_CHOWN_RESTRICTED", 0); #endif #ifdef _PC_LINK_MAX GCST("PC_LINK_MAX", _PC_LINK_MAX); #else GDFLT("PC_LINK_MAX", 0); #endif #ifdef _PC_MAX_CANON GCST("PC_MAX_CANON", _PC_MAX_CANON); #else GDFLT("PC_MAX_CANON", 0); #endif #ifdef _PC_MAX_INPUT GCST("PC_MAX_INPUT", _PC_MAX_INPUT); #else GDFLT("PC_MAX_INPUT", 0); #endif #ifdef _PC_NAME_MAX GCST("PC_NAME_MAX", _PC_NAME_MAX); #else GDFLT("PC_NAME_MAX", 0); #endif #ifdef _PC_NO_TRUNC GCST("PC_NO_TRUNC", _PC_NO_TRUNC); #else GDFLT("PC_NO_TRUNC", 0); #endif #ifdef _PC_PATH_MAX GCST("PC_PATH_MAX", _PC_PATH_MAX); #else GDFLT("PC_PATH_MAX", 0); #endif #ifdef _PC_PIPE_BUF GCST("PC_PIPE_BUF", _PC_PIPE_BUF); #else GDFLT("PC_PIPE_BUF", 0); #endif #ifdef _PC_PRIO_IO GCST("PC_PRIO_IO", _PC_PRIO_IO); #else GDFLT("PC_PRIO_IO", 0); #endif #ifdef _PC_SYNC_IO GCST("PC_SYNC_IO", _PC_SYNC_IO); #else GDFLT("PC_SYNC_IO", 0); #endif #ifdef _PC_SOCK_MAXBUF GCST("PC_SOCK_MAXBUF", _PC_SOCK_MAXBUF); #else GDFLT("PC_SOCK_MAXBUF", 0); #endif #ifdef _SC_AIO_LISTIO_MAX GCST("SC_AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX); #else GDFLT("SC_AIO_LISTIO_MAX", 0); #endif #ifdef _SC_AIO_MAX GCST("SC_AIO_MAX", _SC_AIO_MAX); #else GDFLT("SC_AIO_MAX", 0); #endif #ifdef _SC_AIO_PRIO_DELTA_MAX GCST("SC_AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX); #else GDFLT("SC_AIO_PRIO_DELTA_MAX", 0); #endif #ifdef _SC_ARG_MAX GCST("SC_ARG_MAX", _SC_ARG_MAX); #else GDFLT("SC_ARG_MAX", 0); #endif #ifdef _SC_ASYNCHRONOUS_IO GCST("SC_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO); #else GDFLT("SC_ASYNCHRONOUS_IO", 0); #endif #ifdef _SC_CHILD_MAX GCST("SC_CHILD_MAX", _SC_CHILD_MAX); #else GDFLT("SC_CHILD_MAX", 0); #endif #ifdef _SC_CLK_TCK GCST("SC_CLK_TCK", _SC_CLK_TCK); #else GDFLT("SC_CLK_TCK", 0); #endif #ifdef _SC_DELAYTIMER_MAX GCST("SC_DELAYTIMER_MAX", _SC_DELAYTIMER_MAX); #else GDFLT("SC_DELAYTIMER_MAX", 0); #endif #ifdef _SC_FSYNC GCST("SC_FSYNC", _SC_FSYNC); #else GDFLT("SC_FSYNC", 0); #endif #ifdef _SC_JOB_CONTROL GCST("SC_JOB_CONTROL", _SC_JOB_CONTROL); #else GDFLT("SC_JOB_CONTROL", 0); #endif #ifdef _SC_MAPPED_FILES GCST("SC_MAPPED_FILES", _SC_MAPPED_FILES); #else GDFLT("SC_MAPPED_FILES", 0); #endif #ifdef _SC_MEMLOCK GCST("SC_MEMLOCK", _SC_MEMLOCK); #else GDFLT("SC_MEMLOCK", 0); #endif #ifdef _SC_MEMLOCK_RANGE GCST("SC_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE); #else GDFLT("SC_MEMLOCK_RANGE", 0); #endif #ifdef _SC_MEMORY_PROTECTION GCST("SC_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION); #else GDFLT("SC_MEMORY_PROTECTION", 0); #endif #ifdef _SC_MESSAGE_PASSING GCST("SC_MESSAGE_PASSING", _SC_MESSAGE_PASSING); #else GDFLT("SC_MESSAGE_PASSING", 0); #endif #ifdef _SC_MQ_OPEN_MAX GCST("SC_MQ_OPEN_MAX", _SC_MQ_OPEN_MAX); #else GDFLT("SC_MQ_OPEN_MAX", 0); #endif #ifdef _SC_MQ_PRIO_MAX GCST("SC_MQ_PRIO_MAX", _SC_MQ_PRIO_MAX); #else GDFLT("SC_MQ_PRIO_MAX", 0); #endif #ifdef _SC_NGROUPS_MAX GCST("SC_NGROUPS_MAX", _SC_NGROUPS_MAX); #else GDFLT("SC_NGROUPS_MAX", 0); #endif #ifdef _SC_OPEN_MAX GCST("SC_OPEN_MAX", _SC_OPEN_MAX); #else GDFLT("SC_OPEN_MAX", 0); #endif #ifdef _SC_PAGESIZE GCST("SC_PAGESIZE", _SC_PAGESIZE); #else GDFLT("SC_PAGESIZE", 0); #endif #ifdef _SC_PII GCST("SC_PII", _SC_PII); #else GDFLT("SC_PII", 0); #endif #ifdef _SC_PII_XTI GCST("SC_PII_XTI", _SC_PII_XTI); #else GDFLT("SC_PII_XTI", 0); #endif #ifdef _SC_PII_SOCKET GCST("SC_PII_SOCKET", _SC_PII_SOCKET); #else GDFLT("SC_PII_SOCKET", 0); #endif #ifdef _SC_PII_INTERNET GCST("SC_PII_INTERNET", _SC_PII_INTERNET); #else GDFLT("SC_PII_INTERNET", 0); #endif #ifdef _SC_PII_INTERNET_STREAM GCST("SC_PII_INTERNET_STREAM", _SC_PII_INTERNET_STREAM); #else GDFLT("SC_PII_INTERNET_STREAM", 0); #endif #ifdef _SC_PII_INTERNET_DGRAM GCST("SC_PII_INTERNET_DGRAM", _SC_PII_INTERNET_DGRAM); #else GDFLT("SC_PII_INTERNET_DGRAM", 0); #endif #ifdef _SC_PII_OSI GCST("SC_PII_OSI", _SC_PII_OSI); #else GDFLT("SC_PII_OSI", 0); #endif #ifdef _SC_PII_OSI_M GCST("SC_PII_OSI_M", _SC_PII_OSI_M); #else GDFLT("SC_PII_OSI_M", 0); #endif #ifdef _SC_PII_OSI_COTS GCST("SC_PII_OSI_COTS", _SC_PII_OSI_COTS); #else GDFLT("SC_PII_OSI_COTS", 0); #endif #ifdef _SC_PII_OSI_CLTS GCST("SC_PII_OSI_CLTS", _SC_PII_OSI_CLTS); #else GDFLT("SC_PII_OSI_CLTS", 0); #endif #ifdef _SC_PII_NET_SUPPORT GCST("SC_PII_NET_SUPPORT", _SC_PII_NET_SUPPORT); #else GDFLT("SC_PII_NET_SUPPORT", 0); #endif #ifdef _SC_POLL GCST("SC_POLL", _SC_POLL); #else GDFLT("SC_POLL", 0); #endif #ifdef _SC_POSIX_PII_NET_SUPPORT GCST("SC_POSIX_PII_NET_SUPPORT", _SC_POSIX_PII_NET_SUPPORT); #else GDFLT("SC_POSIX_PII_NET_SUPPORT", 0); #endif #ifdef _SC_PRIORITIZED_IO GCST("SC_PRIORITIZED_IO", _SC_PRIORITIZED_IO); #else GDFLT("SC_PRIORITIZED_IO", 0); #endif #ifdef _SC_PRIORITY_SCHEDULING GCST("SC_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING); #else GDFLT("SC_PRIORITY_SCHEDULING", 0); #endif #ifdef _SC_SELECT GCST("SC_SELECT", _SC_SELECT); #else GDFLT("SC_SELECT", 0); #endif #ifdef _SC_THREAD_PROCESS_SHARED GCST("SC_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED); #else GDFLT("SC_THREAD_PROCESS_SHARED", 0); #endif #ifdef _SC_REALTIME_SIGNALS GCST("SC_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS); #else GDFLT("SC_REALTIME_SIGNALS", 0); #endif #ifdef _SC_RTSIG_MAX GCST("SC_RTSIG_MAX", _SC_RTSIG_MAX); #else GDFLT("SC_RTSIG_MAX", 0); #endif #ifdef _SC_SAVED_IDS GCST("SC_SAVED_IDS", _SC_SAVED_IDS); #else GDFLT("SC_SAVED_IDS", 0); #endif #ifdef _SC_SEMAPHORES GCST("SC_SEMAPHORES", _SC_SEMAPHORES); #else GDFLT("SC_SEMAPHORES", 0); #endif #ifdef _SC_SEM_NSEMS_MAX GCST("SC_SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX); #else GDFLT("SC_SEM_NSEMS_MAX", 0); #endif #ifdef _SC_SEM_VALUE_MAX GCST("SC_SEM_VALUE_MAX", _SC_SEM_VALUE_MAX); #else GDFLT("SC_SEM_VALUE_MAX", 0); #endif #ifdef _SC_SHARED_MEMORY_OBJECTS GCST("SC_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS); #else GDFLT("SC_SHARED_MEMORY_OBJECTS", 0); #endif #ifdef _SC_SIGQUEUE_MAX GCST("SC_SIGQUEUE_MAX", _SC_SIGQUEUE_MAX); #else GDFLT("SC_SIGQUEUE_MAX", 0); #endif #ifdef _SC_STREAM_MAX GCST("SC_STREAM_MAX", _SC_STREAM_MAX); #else GDFLT("SC_STREAM_MAX", 0); #endif #ifdef _SC_SYNCHRONIZED_IO GCST("SC_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO); #else GDFLT("SC_SYNCHRONIZED_IO", 0); #endif #ifdef _SC_THREAD_PRIORITY_SCHEDULING GCST("SC_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING); #else GDFLT("SC_THREAD_PRIORITY_SCHEDULING", 0); #endif #ifdef _SC_THREAD_PRIO_INHERIT GCST("SC_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT); #else GDFLT("SC_THREAD_PRIO_INHERIT", 0); #endif #ifdef _SC_THREAD_PRIO_PROTECT GCST("SC_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT); #else GDFLT("SC_THREAD_PRIO_PROTECT", 0); #endif #ifdef _SC_TIMERS GCST("SC_TIMERS", _SC_TIMERS); #else GDFLT("SC_TIMERS", 0); #endif #ifdef _SC_TIMER_MAX GCST("SC_TIMER_MAX", _SC_TIMER_MAX); #else GDFLT("SC_TIMER_MAX", 0); #endif #ifdef _SC_TZNAME_MAX GCST("SC_TZNAME_MAX", _SC_TZNAME_MAX); #else GDFLT("SC_TZNAME_MAX", 0); #endif #ifdef _SC_T_IOV_MAX GCST("SC_T_IOV_MAX", _SC_T_IOV_MAX); #else GDFLT("SC_T_IOV_MAX", 0); #endif #ifdef _SC_UIO_MAXIOV GCST("SC_UIO_MAXIOV", _SC_UIO_MAXIOV); #else GDFLT("SC_UIO_MAXIOV", 0); #endif #ifdef _SC_VERSION GCST("SC_VERSION", _SC_VERSION); #else GDFLT("SC_VERSION", 0); #endif /* type declarations ----------------- If you make any changes here, also make changes where procedures are declared, above. (***) */ ghdrcmnt("type definitions"); g_off_t(); g_pid_t(); g_gid_t(); g_uid_t(); g_mode_t(); g_suseconds_t(); g_ssize_t(); g_DIR(); g_ino_t(); g_dev_t(); g_cc_t(); g_nlink_t(); g_blksize_t(); g_blkcnt_t(); g_tcflag_t(); g_clockid_t(); g_mqd_t(); g_pthread_attr_t(); g_pthread_cond_t(); g_pthread_condattr_t(); g_pthread_key_t(); g_pthread_mutex_t(); g_pthread_mutexattr_t(); g_pthread_once_t(); g_pthread_t(); g_sem_t(); g_sigset_t(); g_speed_t(); g_socklen_t(); g_timer_t(); g_sigval(); /* must precede siginfo_t and struct_sigevent */ g_siginfo_t(); /* is typedef of a struct type */ ghdrcmnt("structure types"); g_struct_sigevent(); /* must precede aiocb */ g_struct_aiocb(); g_struct_dirent(); g_struct_flock(); g_struct_group(); g_struct_mq_attr(); g_struct_passwd(); g_struct_sigaction(); g_struct_sched_param(); ifprintf(fp," type cc_t_array is array (0 .. NCCS - 1) of cc_t;\n"); g_struct_stat(); gen_unchckd_conv ("To_Stat_Ptr", "Address", "stat_ptr"); g_struct_termios(); gcmnt("timeval structure"); g_struct_timeval(); g_struct_timespec(); g_struct_itimerspec(); g_struct_tm(); g_struct_tms(); g_struct_utimbuf(); { struct utsname DUMMY; ifprintf(fp," subtype utsname_sysname_string is\n" " POSIX_String (1 .. %d);\n", sizeof (DUMMY.sysname)); ifprintf(fp," subtype utsname_nodename_string is\n" " POSIX_String (1 .. %d);\n", sizeof (DUMMY.nodename)); ifprintf(fp," subtype utsname_release_string is\n" " POSIX_String (1 .. %d);\n", sizeof (DUMMY.release)); ifprintf(fp," subtype utsname_version_string is\n" " POSIX_String (1 .. %d);\n", sizeof (DUMMY.version)); ifprintf(fp," subtype utsname_machine_string is\n" " POSIX_String (1 .. %d);\n", sizeof (DUMMY.machine)); } g_struct_utsname(); /* ......need to figure what to do with functions, next..... */ ghdrcmnt("link names for C functions"); GFUNC(access,HAVE_access); GFUNC(aio_cancel,HAVE_aio_cancel); GFUNC(aio_error,HAVE_aio_error); GFUNC(aio_fsync,HAVE_aio_fsync); GFUNC(aio_read,HAVE_aio_read); GFUNC(aio_return,HAVE_aio_return); GFUNC(aio_suspend,HAVE_aio_suspend); GFUNC(aio_write,HAVE_aio_write); /* GFUNC(alarm,HAVE_alarm); */ /* GFUNC(asctime,HAVE_asctime); */ GFUNC(cfgetispeed,HAVE_cfgetispeed); GFUNC(cfgetospeed,HAVE_cfgetospeed); GFUNC(cfsetispeed,HAVE_cfsetispeed); GFUNC(cfsetospeed,HAVE_cfsetospeed); GFUNC(chdir,HAVE_chdir); GFUNC(chmod,HAVE_chmod); GFUNC(chown,HAVE_chown); GFUNC(clock_getres,HAVE_clock_getres); GFUNC(clock_gettime,HAVE_clock_gettime); GFUNC(clock_settime,HAVE_clock_settime); GFUNC(close,HAVE_close); GFUNC(closedir,HAVE_closedir); /* GFUNC(creat,HAVE_creat); */ GFUNC(ctermid,HAVE_ctermid); GFUNC(ctime,HAVE_ctime); #if defined(SOLARIS_HACK) if (HAVE___posix_ctime_r == 1) { gfuncsol("ctime_r","__posix_ctime_r"); } else { GFUNC(ctime_r,HAVE_ctime_r); } #else GFUNC(ctime_r,HAVE_ctime_r); #endif GFUNC(dup,HAVE_dup); GFUNC(dup2,HAVE_dup2); /* .... still need to check all the following functions, to verify how they return errors, and arrange for the correct kind of stub link-name to be generated if the function is not supported */ /* The execl* version of execl should not be used directly, since wrappers must be provided for all variadic functions. GFUNC(execl,HAVE_execl); GFUNC(execle,HAVE_execle); GFUNC(execlp,HAVE_execlp); */ GFUNC(execv,HAVE_execv); GFUNC(execve,HAVE_execve); GFUNC(execvp,HAVE_execvp); GFUNC(fchmod,HAVE_fchmod); GFUNC(fcntl,HAVE_fcntl); GFUNC(fdatasync,HAVE_fdatasync); /* GFUNC(fdopen,HAVE_fdopen); */ /* GFUNC(fileno,HAVE_fileno); */ /* GFUNC(flockfile,HAVE_flockfile); */ GFUNC(fork,HAVE_fork); GFUNC(fpathconf,HAVE_fpathconf); GFUNC(fstat,HAVE_fstat); GFUNC(fsync,HAVE_fsync); GFUNC(ftruncate,HAVE_ftruncate); /* GFUNC(funlockfile,HAVE_funlockfile); */ /* GFUNC(getc_unlocked,HAVE_getc_unlocked); */ /* GFUNC(getchar_unlocked,HAVE_getchar_unlocked); */ GFUNC(getcwd,HAVE_getcwd); GFUNC(getegid,HAVE_getegid); GFUNC(getenv,HAVE_getenv); GFUNC(geteuid,HAVE_geteuid); GFUNC(getgid,HAVE_getgid); GFUNC(getgrgid,HAVE_getgrgid); GFUNC(getgrnam,HAVE_getgrnam); GFUNC(getgroups,HAVE_getgroups); GFUNC(getlogin,HAVE_getlogin); GFUNC(getpgrp,HAVE_getpgrp); GFUNC(getpid,HAVE_getpid); GFUNC(getppid,HAVE_getppid); GFUNC(getpwnam,HAVE_getpwnam); GFUNC(getpwuid,HAVE_getpwuid); GFUNC(gettimeofday,HAVE_gettimeofday); GFUNC(getuid,HAVE_getuid); GFUNC(gmtime_r,HAVE_gmtime_r); GFUNC(isatty,HAVE_isatty); GFUNC(kill,HAVE_kill); GFUNC(link,HAVE_link); GFUNC(lio_listio,HAVE_lio_listio); GFUNC(lstat, HAVE_lstat); /* GFUNC(localtime_r,HAVE_localtime_r); */ GFUNC(lseek,HAVE_lseek); GFUNC(mkdir,HAVE_mkdir); GFUNC(mkfifo,HAVE_mkfifo); GFUNC(mlock,HAVE_mlock); GFUNC(mlockall,HAVE_mlockall); GFUNC(mmap,HAVE_mmap); GFUNC(mprotect,HAVE_mprotect); GFUNC(mq_close,HAVE_mq_close); GFUNC(mq_getattr,HAVE_mq_getattr); GFUNC(mq_notify,HAVE_mq_notify); GFUNC(mq_open,HAVE_mq_open); GFUNC(mq_receive,HAVE_mq_receive); GFUNC(mq_send,HAVE_mq_send); GFUNC(mq_setattr,HAVE_mq_setattr); GFUNC(mq_unlink,HAVE_mq_unlink); GFUNC(msync,HAVE_msync); GFUNC(munlock,HAVE_munlock); GFUNC(munlockall,HAVE_munlockall); GFUNC(munmap,HAVE_munmap); /* GFUNC(nanosleep,HAVE_nanosleep); */ GFUNC(open,HAVE_open); GFUNC(opendir,HAVE_opendir); GFUNC(pathconf,HAVE_pathconf); /* GFUNC(pause,HAVE_pause); */ /* GFUNC(perror,HAVE_perror); */ GFUNC(pipe,HAVE_pipe); /* GFUNCD(pthread_atfork,HAVE_pthread_atfork); */ /* GFUNCD(pthread_attr_destroy,HAVE_pthread_attr_destroy); */ /* GFUNCD(pthread_attr_getdetachstate,HAVE_pthread_attr_getdetachstate); */ /* GFUNCD(pthread_attr_getinheritsched,HAVE_pthread_attr_getinheritsched); */ /* GFUNCD(pthread_attr_getschedparam,HAVE_pthread_attr_getschedparam); */ /* GFUNCD(pthread_attr_getschedpolicy,HAVE_pthread_attr_getschedpolicy); */ /* GFUNCD(pthread_attr_getscope,HAVE_pthread_attr_getscope); */ /* GFUNCD(pthread_attr_getstackaddr,HAVE_pthread_attr_getstackaddr); */ /* GFUNCD(pthread_attr_getstacksize,HAVE_pthread_attr_getstacksize); */ /* GFUNCD(pthread_attr_init,HAVE_pthread_attr_init); */ /* GFUNCD(pthread_attr_setdetachstate,HAVE_pthread_attr_setdetachstate); */ /* GFUNCD(pthread_attr_setinheritsched,HAVE_pthread_attr_setinheritsched); */ /* GFUNCD(pthread_attr_setschedparam,HAVE_pthread_attr_setschedparam); */ /* GFUNCD(pthread_attr_setschedpolicy,HAVE_pthread_attr_setschedpolicy); */ /* GFUNCD(pthread_attr_setscope,HAVE_pthread_attr_setscope); */ /* GFUNCD(pthread_attr_setstackaddr,HAVE_pthread_attr_setstackaddr); */ /* GFUNCD(pthread_attr_setstacksize,HAVE_pthread_attr_setstacksize); */ /* GFUNCD(pthread_cancel,HAVE_pthread_cancel); */ /* GFUNCD(pthread_cleanup_pop,HAVE_pthread_cleanup_pop); */ /* GFUNCD(pthread_cleanup_push,HAVE_pthread_cleanup_push); */ GFUNCD(pthread_cond_broadcast,HAVE_pthread_cond_broadcast); GFUNCD(pthread_cond_destroy,HAVE_pthread_cond_destroy); GFUNCD(pthread_cond_init,HAVE_pthread_cond_init); GFUNCD(pthread_cond_signal,HAVE_pthread_cond_signal); GFUNCD(pthread_cond_timedwait,HAVE_pthread_cond_timedwait); GFUNCD(pthread_cond_wait,HAVE_pthread_cond_wait); GFUNCD(pthread_condattr_destroy,HAVE_pthread_condattr_destroy); GFUNCD(pthread_condattr_getpshared,HAVE_pthread_condattr_getpshared); GFUNCD(pthread_condattr_init,HAVE_pthread_condattr_init); GFUNCD(pthread_condattr_setpshared,HAVE_pthread_condattr_setpshared); /* GFUNCD(pthread_create,HAVE_pthread_create); */ /* GFUNCD(pthread_equal,HAVE_pthread_equal); */ /* GFUNCD(pthread_exit,HAVE_pthread_exit); */ /* GFUNCD(pthread_getschedparam,HAVE_pthread_getschedparam); */ /* GFUNCD(pthread_getspecific,HAVE_pthread_getspecific); */ /* GFUNCD(pthread_join,HAVE_pthread_join); */ /* GFUNCD(pthread_key_create,HAVE_pthread_key_create); */ /* GFUNCD(pthread_key_delete,HAVE_pthread_key_delete); */ /* GFUNCD(pthread_kill,HAVE_pthread_kill); */ GFUNCD(pthread_mutex_destroy,HAVE_pthread_mutex_destroy); GFUNCD(pthread_mutex_getprioceiling,HAVE_pthread_mutex_getprioceiling); GFUNCD(pthread_mutex_init,HAVE_pthread_mutex_init); GFUNCD(pthread_mutex_lock,HAVE_pthread_mutex_lock); GFUNCD(pthread_mutex_setprioceiling,HAVE_pthread_mutex_setprioceiling); GFUNCD(pthread_mutex_trylock,HAVE_pthread_mutex_trylock); GFUNCD(pthread_mutex_unlock,HAVE_pthread_mutex_unlock); GFUNCD(pthread_mutexattr_destroy,HAVE_pthread_mutexattr_destroy); GFUNCD(pthread_mutexattr_getprioceiling, HAVE_pthread_mutexattr_getprioceiling); GFUNCD(pthread_mutexattr_getprotocol,HAVE_pthread_mutexattr_getprotocol); GFUNCD(pthread_mutexattr_getpshared,HAVE_pthread_mutexattr_getpshared); GFUNCD(pthread_mutexattr_init,HAVE_pthread_mutexattr_init); GFUNCD(pthread_mutexattr_setprioceiling, HAVE_pthread_mutexattr_setprioceiling); GFUNCD(pthread_mutexattr_setprotocol,HAVE_pthread_mutexattr_setprotocol); /* if not supported, the error code is Operation_Not_Implemented, i.e., ENOSYS */ GFUNCD(pthread_mutexattr_setpshared,HAVE_pthread_mutexattr_setpshared); /* GFUNCD(pthread_once,HAVE_pthread_once); */ /* GFUNCD(pthread_self,HAVE_pthread_self); */ /* GFUNCD(pthread_setcancelstate,HAVE_pthread_setcancelstate); */ /* GFUNCD(pthread_setcanceltype,HAVE_pthread_setcanceltype); */ /* GFUNCD(pthread_setschedparam,HAVE_pthread_setschedparam); */ /* GFUNCD(pthread_setspecific,HAVE_pthread_setspecific); */ GFUNCD(pthread_sigmask,HAVE_pthread_sigmask); /* GFUNCD(pthread_testcancel,HAVE_pthread_testcancel); */ /* GFUNC(putc_unlocked,HAVE_putc_unlocked); */ /* GFUNC(putchar_unlocked,HAVE_putchar_unlocked); */ GFUNC(putenv,HAVE_putenv); /* GFUNC(rand_r,HAVE_rand_r); */ GFUNC(read,HAVE_read); GFUNC(readdir,HAVE_readdir); #if defined(SOLARIS_HACK) && (_FILE_OFFSET_BITS != 64) if (HAVE___posix_readdir_r == 1) { gfuncsol("readdir_r","__posix_readdir_r"); } else { GFUNC(readdir_r,HAVE_readdir_r); } #else GFUNC(readdir_r,HAVE_readdir_r); #endif GFUNC(rename,HAVE_rename); /* GFUNC(rewinddir,HAVE_rewinddir); */ /* GFUNC(rewinddir_r,HAVE_rewinddir_r); */ GFUNC(rmdir,HAVE_rmdir); GFUNC(sched_get_priority_max,HAVE_sched_get_priority_max); GFUNC(sched_get_priority_min,HAVE_sched_get_priority_min); GFUNC(sched_rr_get_interval,HAVE_sched_rr_get_interval); GFUNC(sched_getparam,HAVE_sched_getparam); GFUNC(sched_getscheduler,HAVE_sched_getscheduler); GFUNC(sched_setparam,HAVE_sched_setparam); GFUNC(sched_setscheduler,HAVE_sched_setscheduler); GFUNC(sched_yield,HAVE_sched_yield); GFUNC(sem_close,HAVE_sem_close); GFUNC(sem_destroy,HAVE_sem_destroy); GFUNC(sem_getvalue,HAVE_sem_getvalue); GFUNC(sem_init,HAVE_sem_init); GFUNC(sem_open,HAVE_sem_open); GFUNC(sem_post,HAVE_sem_post); GFUNC(sem_trywait,HAVE_sem_trywait); GFUNC(sem_unlink,HAVE_sem_unlink); GFUNC(sem_wait,HAVE_sem_wait); GFUNC(setenv,HAVE_setenv); GFUNC(setgid,HAVE_setgid); GFUNC(setpgid,HAVE_setpgid); GFUNC(setsid,HAVE_setsid); GFUNC(setuid,HAVE_setuid); GFUNC(shm_open,HAVE_shm_open); GFUNC(shm_unlink,HAVE_shm_unlink); GFUNC(sigaction,HAVE_sigaction); GFUNC(sigaddset,HAVE_sigaddset); GFUNC(sigdelset,HAVE_sigdelset); GFUNC(sigemptyset,HAVE_sigemptyset); GFUNC(sigfillset,HAVE_sigfillset); GFUNC(sigismember,HAVE_sigismember); #ifdef siglongjmp /* ifprintf(fp," -- *** WARNING: %s is a macro *** --\n", "siglongjmp"); */ #endif /* GFUNC(siglongjmp,HAVE_siglongjmp); */ GFUNC(sigpending,HAVE_sigpending); GFUNC(sigprocmask,HAVE_sigprocmask); GFUNC(sigqueue,HAVE_sigqueue); #ifdef sigsetjmp /* ifprintf(fp," -- *** WARNING: %s is a macro *** --\n", "sigsetjmp"); */ #endif /* GFUNC(sigsetjmp,HAVE_sigsetjmp); */ /* GFUNC(sigsuspend,HAVE_sigsuspend); */ GFUNC(sigtimedwait,HAVE_sigtimedwait); #if defined(SOLARIS_HACK) if (HAVE___posix_sigwait == 1) { gfuncsol("sigwait","__posix_sigwait"); } else { GFUNC(sigwait,HAVE_sigwait); } #else GFUNC(sigwait,HAVE_sigwait); #endif GFUNC(sigwaitinfo,HAVE_sigwaitinfo); /* GFUNC(sleep,HAVE_sleep); */ GFUNC(stat,HAVE_stat); /* GFUNC(strtok_r,HAVE_strtok_r); */ GFUNC(sysconf,HAVE_sysconf); GFUNC(tcdrain,HAVE_tcdrain); GFUNC(tcflow,HAVE_tcflow); GFUNC(tcflush,HAVE_tcflush); GFUNC(tcgetattr,HAVE_tcgetattr); GFUNC(tcgetpgrp,HAVE_tcgetpgrp); GFUNC(tcsendbreak,HAVE_tcsendbreak); GFUNC(tcsetattr,HAVE_tcsetattr); GFUNC(tcsetpgrp,HAVE_tcsetpgrp); GFUNC(time,HAVE_time); GFUNC(timer_create,HAVE_timer_create); /* POSIX.5b erroneously specifies OPERATION_NOT_SUPPORTED for Create/Delete_Timer. That is inconsistent with POSIX.1b. Therefore, we follow POSIX.1b instead. */ GFUNC(timer_delete,HAVE_timer_delete); GFUNC(timer_getoverrun,HAVE_timer_getoverrun); GFUNC(timer_gettime,HAVE_timer_gettime); GFUNC(timer_settime,HAVE_timer_settime); GFUNC(times,HAVE_times); GFUNC(ttyname,HAVE_ttyname); /* GFUNC(tzset,HAVE_tzset); */ GFUNC(umask,HAVE_umask); GFUNC(uname,HAVE_uname); GFUNC(unlink,HAVE_unlink); GFUNC(unsetenv,HAVE_unsetenv); GFUNC(utime,HAVE_utime); /* GFUNC(wait,HAVE_wait); */ GFUNC(waitpid,HAVE_waitpid); GFUNC(write,HAVE_write); ghdrcmnt("C functions for macros"); gmacrofunc("s_isdir","mode_t","mode"); gmacrofunc("s_ischr","mode_t","mode"); gmacrofunc("s_isblk","mode_t","mode"); gmacrofunc("s_islnk","mode_t","mode"); gmacrofunc("s_isreg","mode_t","mode"); gmacrofunc("s_isfifo","mode_t","mode"); gmacrofunc("s_ismsg","mode_t","mode"); gmacrofunc("s_issem","mode_t","mode"); gmacrofunc("s_isshm","mode_t","mode"); gmacrofunc("s_issock","mode_t","mode"); gmacrofunc("s_typeismq","stat_ptr","stat"); gmacrofunc("s_typeissem","stat_ptr","stat"); gmacrofunc("s_typeisshm","stat_ptr","stat"); gmacrofunc("wifexited","int","stat_val"); gmacrofunc("wifexitstatus","int","stat_val"); gmacrofunc("wifsignaled","int","stat_val"); gmacrofunc("wiftermsig","int","stat_val"); gmacrofunc("wifstopped","int","stat_val"); gmacrofunc("wifstopsig","int","stat_val"); /* c_sockets ---------------- */ indent++; ifprintf(fp,"package Sockets is\n"); ghdrcmnt("socket.h"); #ifdef HAVE_sa_family_t guitp("sa_family_t", sizeof(sa_family_t)); #else NON_SUPPORT_MESSAGE("sa_family_t") guitp("sa_family_t", sizeof(short)); #endif #ifdef HAVE_in_port_t guitp("in_port_t", sizeof(in_port_t)); #else NON_SUPPORT_MESSAGE("in_port_t") guitp("in_port_t", sizeof(in_port_t)); #endif ghdrcmnt("constants"); #ifdef HOST_NOT_FOUND GCST("HOST_NOT_FOUND", HOST_NOT_FOUND); #else GDFLT("HOST_NOT_FOUND", 0); #endif #ifdef NO_DATA GCST("NO_DATA", NO_DATA); #else GDFLT("NO_DATA", 0); #endif #ifdef NO_RECOVERY GCST("NO_RECOVERY", NO_RECOVERY); #else GDFLT("NO_RECOVERY", 0); #endif #ifdef TRY_AGAIN GCST("TRY_AGAIN", TRY_AGAIN); #else GDFLT("TRY_AGAIN", 0); #endif #ifdef MAX_SOCKADDR_EXT GCST("MAX_SOCKADDR_EXT", MAX_SOCKADDR_EXT); #else GDFLT("MAX_SOCKADDR_EXT", 108); #endif gcmnt("sockets protocol level"); #ifdef SOL_SOCKET GCST("SOL_SOCKET", SOL_SOCKET); #else GDFLT("SOL_SOCKET", 0); #endif gcmnt("socket types"); #ifdef SOCK_STREAM GCST("SOCK_STREAM", SOCK_STREAM); #else GDFLT("SOCK_STREAM", 0); #endif #ifdef SOCK_DGRAM GCST("SOCK_DGRAM", SOCK_DGRAM); #else GDFLT("SOCK_DGRAM", 0); #endif #ifdef SOCK_RAW GCST("SOCK_RAW", SOCK_RAW); #else GDFLT("SOCK_RAW", 0); #endif #ifdef SOCK_SEQPACKET GCST("SOCK_SEQPACKET", SOCK_SEQPACKET); #else GDFLT("SOCK_SEQPACKET", 0); #endif gcmnt("address families"); #ifdef AF_MAX GCST("AF_MAX", AF_MAX); #else GDFLT("AF_MAX", 0); #endif #ifdef AF_UNSPEC GCST("AF_UNSPEC", AF_UNSPEC); #else GDFLT("AF_UNSPEC", 0); #endif #ifdef AF_UNIX GCST("AF_UNIX", AF_UNIX); #else GDFLT("AF_UNIX", 0); #endif #ifdef AF_LOCAL GCST("AF_LOCAL", AF_LOCAL); #else #ifdef AF_UNIX GCST("AF_LOCAL", AF_UNIX); #else GDFLT("AF_LOCAL", 0); #endif #endif #ifdef AF_INET GCST("AF_INET", AF_INET); #else GDFLT("AF_INET", 0); #endif #ifdef AF_OSI GCST("AF_OSI", AF_OSI); #else GDFLT("AF_OSI", 0); #endif #ifdef AF_ISO GCST("AF_ISO", AF_ISO); #else GDFLT("AF_ISO", 0); #endif gcmnt("protocol families"); #ifdef PF_MAX GCST("PF_MAX", PF_MAX); #else GDFLT("PF_MAX", 0); #endif #ifdef PF_UNSPEC GCST("PF_UNSPEC", PF_UNSPEC); #else GDFLT("PF_UNSPEC", 0); #endif #ifdef PF_LOCAL GCST("PF_LOCAL", PF_LOCAL); #else #ifdef PF_UNIX GCST("PF_LOCAL", PF_UNIX); #else GDFLT("PF_LOCAL", 0); #endif #endif #ifdef PF_UNIX GCST("PF_UNIX", PF_UNIX); #else GDFLT("PF_UNIX", 0); #endif #ifdef PF_INET GCST("PF_INET", PF_INET); #else GDFLT("PF_INET", 0); #endif #ifdef PF_OSI GCST("PF_OSI", PF_OSI); #else GDFLT("PF_OSI", 0); #endif #ifdef PF_ISO GCST("PF_ISO", PF_ISO); #else GDFLT("PF_ISO", 0); #endif gcmnt("socket options"); #ifdef SO_BROADCAST GUCST("SO_BROADCAST", SO_BROADCAST); #else GDFLT("SO_BROADCAST", 0); #endif #ifdef SO_DEBUG GCST("SO_DEBUG", SO_DEBUG); #else GDFLT("SO_DEBUG", 0); #endif #ifdef SO_DONTROUTE GCST("SO_DONTROUTE", SO_DONTROUTE); #else GDFLT("SO_DONTROUTE", 0); #endif #ifdef SO_ERROR GCST("SO_ERROR", SO_ERROR); #else GDFLT("SO_ERROR", 0); #endif #ifdef SO_KEEPALIVE GCST("SO_KEEPALIVE", SO_KEEPALIVE); #else GDFLT("SO_KEEPALIVE", 0); #endif #ifdef SO_LINGER GCST("SO_LINGER", SO_LINGER); #else GDFLT("SO_LINGER", 0); #endif #ifdef SO_OOBINLINE GCST("SO_OOBINLINE", SO_OOBINLINE); #else GDFLT("SO_OOBINLINE", 0); #endif #ifdef SO_RCVBUF GCST("SO_RCVBUF", SO_RCVBUF); #else GDFLT("SO_RCVBUF", 0); #endif #ifdef SO_RCVLOWAT GCST("SO_RCVLOWAT", SO_RCVLOWAT); #else GDFLT("SO_RCVLOWAT", 0); #endif #ifdef SO_RCVTIMEO GCST("SO_RCVTIMEO", SO_RCVTIMEO); #else GDFLT("SO_RCVTIMEO", 0); #endif #ifdef SO_REUSEADDR GCST("SO_REUSEADDR", SO_REUSEADDR); #else GDFLT("SO_REUSEADDR", 0); #endif #ifdef SO_SNDBUF GCST("SO_SNDBUF", SO_SNDBUF); #else GDFLT("SO_SNDBUF", 0); #endif #ifdef SO_SNDLOWAT GCST("SO_SNDLOWAT", SO_SNDLOWAT); #else GDFLT("SO_SNDLOWAT", 0); #endif #ifdef SO_SNDTIMEO GCST("SO_SNDTIMEO", SO_SNDTIMEO); #else GDFLT("SO_SNDTIMEO", 0); #endif #ifdef SO_TYPE GCST("SO_TYPE", SO_TYPE); #else GDFLT("SO_TYPE", 0); #endif gcmnt("max queued connections"); #ifdef SOMAXCONN GCST("SOMAXCONN", SOMAXCONN); #else GDFLT("SOMAXCONN", 0); #endif gcmnt("send & receive option flag bits"); #ifdef MSG_OOB GCST("MSG_OOB", MSG_OOB); #else GDFLT("MSG_OOB", 0); #endif #ifdef MSG_PEEK GCST("MSG_PEEK", MSG_PEEK); #else GDFLT("MSG_PEEK", 0); #endif #ifdef MSG_DONTROUTE GCST("MSG_DONTROUTE", MSG_DONTROUTE); #else GDFLT("MSG_DONTROUTE", 0); #endif #ifdef MSG_EOR GCST("MSG_EOR", MSG_EOR); #else GDFLT("MSG_EOR", 0); #endif #ifdef MSG_TRUNC GCST("MSG_TRUNC", MSG_TRUNC); #else GDFLT("MSG_TRUNC", 0); #endif #ifdef MSG_CTRUNC GCST("MSG_CTRUNC", MSG_CTRUNC); #else GDFLT("MSG_CTRUNC", 0); #endif #ifdef MSG_WAITALL GCST("MSG_WAITALL", MSG_WAITALL); #else GDFLT("MSG_WAITALL", 0); #endif #ifdef MSG_MAXIOVLEN GCST("MSG_MAXIOVLEN", MSG_MAXIOVLEN); #else GDFLT("MSG_MAXIOVLEN", 0); #endif gcmnt("socket address information option flag bits"); #ifdef AI_PASSIVE GCST("AI_PASSIVE", AI_PASSIVE); #else GDFLT("AI_PASSIVE", 0); #endif #ifdef AI_CANONNAME GCST("AI_CANONNAME", AI_CANONNAME); #else GDFLT("AI_CANONNAME", 0); #endif gcmnt("scoket shutdown mode flag bits"); #ifdef SHUT_RD GCST("SHUT_RD", SHUT_RD); #else GDFLT("SHUT_RD", 0); #endif #ifdef SHUT_WR GCST("SHUT_WR", SHUT_WR); #else GDFLT("SHUT_WR", 1); #endif #ifdef SHUT_RDWR GCST("SHUT_RDWR", SHUT_RDWR); #else GDFLT("SHUT_RDWR", 2); #endif ghdrcmnt("structures"); /* can't follow alphabetic ordering; e.g. sockaddr needs to come early, to avoid forward references */ gcmnt("generic socket address"); g_struct_sockaddr(); gcmnt("struct addrinfo..."); g_struct_addrinfo(); gcmnt("message option header"); g_struct_cmsghdr(); gcmnt("host database entry"); g_struct_hostent(); gcmnt("internet address"); #ifdef HAVE_in_addr_t guitp("in_addr_t", sizeof(in_addr_t)); #else NON_SUPPORT_MESSAGE("in_addr_t") guitp("in_addr_t", sizeof(long)); #endif g_struct_in_addr(); gcmnt("linger option structure"); g_struct_linger(); gcmnt("I/O vector"); g_struct_iovec(); gcmnt("message header"); g_struct_msghdr(); gcmnt("local socket address"); { struct sockaddr_un DUMMY; ifprintf(fp," subtype sun_path_string is POSIX_String (1 .. %d);\n", sizeof (DUMMY.sun_path)); } g_struct_sockaddr_un(); gcmnt("internet socket address"); g_struct_sockaddr_in(); gcmnt("IP Level ip_opts structure"); g_struct_ip_opts(); ghdrcmnt("link names for functions"); GFUNC(accept, HAVE_accept); GFUNC(bind, HAVE_bind); GFUNC(connect, HAVE_connect); GFUNC(getsockname, HAVE_getsockname); GFUNC(getsockopt, HAVE_getsockopt); GFUNC(isfdtype, HAVE_isfdtype); GFUNC(listen, HAVE_listen); GFUNC(recv, HAVE_recv); GFUNC(recvfrom, HAVE_recvfrom); GFUNC(recvmsg, HAVE_recvmsg); GFUNC(send, HAVE_send); GFUNC(sendto, HAVE_sendto); GFUNC(sendmsg, HAVE_sendmsg); GFUNC(setsockopt, HAVE_setsockopt); GFUNC(shutdown, HAVE_shutdown); GFUNC(socket, HAVE_socket); GFUNC(sockatmark, HAVE_sockatmark); GFUNC(socketpair, HAVE_socketpair); fprintf(fp,"\n"); ifprintf(fp,"end Sockets;\n\n"); indent--; /* c_xti ---------------- */ indent++; ifprintf(fp,"package XTI is\n"); ghdrcmnt("XTI structures"); /* can't follow alphabetic ordering; e.g. */ gcmnt("netbuf structure"); g_struct_netbuf(); gcmnt("t_info structure"); g_struct_t_info(); gcmnt("t_opthdr structure"); g_struct_t_opthdr(); gcmnt("t_bind structure"); g_struct_t_bind(); gcmnt("t_optmgmt structure"); g_struct_t_optmgmt(); gcmnt("t_discon structure"); g_struct_t_discon(); gcmnt("t_call structure"); g_struct_t_call(); gcmnt("t_unitdata structure"); g_struct_t_unitdata(); gcmnt("t_uderr structure"); g_struct_t_uderr(); gcmnt("t_iovec structure"); g_struct_t_iovec(); gcmnt("t_kpalive structure"); g_struct_t_kpalive(); /* * The following are the events returned from t_look() */ gcmnt("The following are the events returned from t_look()"); #ifdef T_LISTEN GCST("T_LISTEN", T_LISTEN ); #else GDFLT("T_LISTEN", 0); #endif #ifdef T_CONNECT GCST("T_CONNECT", T_CONNECT ); #else GDFLT("T_CONNECT", 0); #endif #ifdef T_DATA GCST("T_DATA", T_DATA ); #else GDFLT("T_DATA", 0); #endif #ifdef T_EXDATA GCST("T_EXDATA", T_EXDATA ); #else GDFLT("T_EXDATA", 0); #endif #ifdef T_DISCONNECT GCST("T_DISCONNECT", T_DISCONNECT ); #else GDFLT("T_DISCONNECT", 0); #endif #ifdef T_UDERR GCST("T_UDERR", T_UDERR ); #else GDFLT("T_UDERR", 0); #endif #ifdef T_ORDREL GCST("T_ORDREL", T_ORDREL ); #else GDFLT("T_ORDREL", 0); #endif #ifdef T_GODATA GCST("T_GODATA", T_GODATA ); #else GDFLT("T_GODATA", 0); #endif #ifdef T_GOEXDATA GCST("T_GOEXDATA", T_GOEXDATA ); #else GDFLT("T_GOEXDATA", 0); #endif #ifdef T_EVENTS GCST("T_EVENTS", T_EVENTS ); #else GDFLT("T_EVENTS", 0); #endif /* * The following are the flag definitions needed by the * user level library routines. */ #ifdef T_MORE GCST("T_MORE", T_MORE ); #else GDFLT("T_MORE", 0); #endif #ifdef T_EXPEDITED GCST("T_EXPEDITED", T_EXPEDITED ); #else GDFLT("T_EXPEDITED", 0); #endif #ifdef T_PUSH GCST("T_PUSH", T_PUSH ); #else GDFLT("T_PUSH", 0); #endif #ifdef T_NEGOTIATE GCST("T_NEGOTIATE", T_NEGOTIATE ); #else GDFLT("T_NEGOTIATE", 0); #endif #ifdef T_CHECK GCST("T_CHECK", T_CHECK ); #else GDFLT("T_CHECK", 0); #endif #ifdef T_DEFAULT GCST("T_DEFAULT", T_DEFAULT ); #else GDFLT("T_DEFAULT", 0); #endif #ifdef T_SUCCESS GCST("T_SUCCESS", T_SUCCESS ); #else GDFLT("T_SUCCESS", 0); #endif #ifdef T_FAILURE GCST("T_FAILURE", T_FAILURE ); #else GDFLT("T_FAILURE", 0); #endif #ifdef T_CURRENT GCST("T_CURRENT", T_CURRENT ); #else GDFLT("T_CURRENT", 0); #endif #ifdef T_PARTSUCCESS GCST("T_PARTSUCCESS", T_PARTSUCCESS ); #else GDFLT("T_PARTSUCCESS", 0); #endif #ifdef T_READONLY GCST("T_READONLY", T_READONLY ); #else GDFLT("T_READONLY", 0); #endif #ifdef T_NOTSUPPORT GCST("T_NOTSUPPORT", T_NOTSUPPORT ); #else GDFLT("T_NOTSUPPORT", 0); #endif #ifdef T_RAW GCST("T_RAW", T_RAW ); #else GDFLT("T_RAW", 0); #endif /* * Service types defines */ gcmnt("Service types defines"); #ifdef T_COTS GCST("T_COTS", T_COTS ); #else GDFLT("T_COTS", 0); #endif #ifdef T_COTS_ORD GCST("T_COTS_ORD", T_COTS_ORD ); #else GDFLT("T_COTS_ORD", 0); #endif #ifdef T_CLTS GCST("T_CLTS", T_CLTS ); #else GDFLT("T_CLTS", 0); #endif /* * Flags defines (other info about the transport provider). */ #ifdef T_SENDZERO GCST("T_SENDZERO", T_SENDZERO ); #else GDFLT("T_SENDZERO", 0); #endif #ifdef SENDZERO GCST("SENDZERO", SENDZERO ); #else GDFLT("SENDZERO", 0); #endif #ifdef T_XPG4_1 GCST("T_XPG4_1", T_XPG4_1 ); #else GDFLT("T_XPG4_1", 0); #endif #ifdef XPG4_1 GCST("XPG4_1", XPG4_1 ); #else GDFLT("XPG4_1", 0); #endif /* * The following are structure types used when dynamically * allocating the above structure via alloc(). */ #ifdef T_BIND GCST("T_BIND", T_BIND ); #else GDFLT("T_BIND", 0); #endif #ifdef T_OPTMGMT GCST("T_OPTMGMT", T_OPTMGMT ); #else GDFLT("T_OPTMGMT", 0); #endif #ifdef T_CALL GCST("T_CALL", T_CALL ); #else GDFLT("T_CALL", 0); #endif #ifdef T_DIS GCST("T_DIS", T_DIS ); #else GDFLT("T_DIS", 0); #endif #ifdef T_UNITDATA GCST("T_UNITDATA", T_UNITDATA ); #else GDFLT("T_UNITDATA", 0); #endif #ifdef T_UDERROR GCST("T_UDERROR", T_UDERROR ); #else GDFLT("T_UDERROR", 0); #endif #ifdef T_INFO GCST("T_INFO", T_INFO ); #else GDFLT("T_INFO", 0); #endif #ifdef T_KUNITDATA GCST("T_KUNITDATA", T_KUNITDATA ); #else GDFLT("T_KUNITDATA", 0); #endif /* * The following bits specify which fields of the above * structures should be allocated by t_alloc(). */ #ifdef T_ADDR GCST("T_ADDR", T_ADDR ); #else GDFLT("T_ADDR", 0); #endif #ifdef T_OPT GCST("T_OPT", T_OPT ); #else GDFLT("T_OPT", 0); #endif #ifdef T_UDATA GCST("T_UDATA", T_UDATA ); #else GDFLT("T_UDATA", 0); #endif #ifdef T_ALL GCST("T_ALL", T_ALL ); #else GDFLT("T_ALL", 0); #endif /* * The following are the states for the user. */ #ifdef T_UNINIT GCST("T_UNINIT", T_UNINIT ); #else GDFLT("T_UNINIT", 0); #endif #ifdef T_UNBND GCST("T_UNBND", T_UNBND ); #else GDFLT("T_UNBND", 0); #endif #ifdef T_IDLE GCST("T_IDLE", T_IDLE ); #else GDFLT("T_IDLE", 0); #endif #ifdef T_OUTCON GCST("T_OUTCON", T_OUTCON ); #else GDFLT("T_OUTCON", 0); #endif #ifdef T_INCON GCST("T_INCON", T_INCON ); #else GDFLT("T_INCON", 0); #endif #ifdef T_DATAXFER GCST("T_DATAXFER", T_DATAXFER ); #else GDFLT("T_DATAXFER", 0); #endif #ifdef T_OUTREL GCST("T_OUTREL", T_OUTREL ); #else GDFLT("T_OUTREL", 0); #endif #ifdef T_INREL GCST("T_INREL", T_INREL ); #else GDFLT("T_INREL", 0); #endif /* General purpose defines */ #ifdef T_YES GCST("T_YES", T_YES ); #else # if defined(_TLI_) GCST("T_YES", 1); # else GDFLT("T_YES", 0); # endif #endif #ifdef T_NO GCST("T_NO", T_NO ); #else # if defined(_TLI_) GCST("T_NO", 0); # else GDFLT("T_NO", 0); # endif #endif #ifdef T_UNUSED GCST("T_UNUSED", T_UNUSED ); #else # if defined(_TLI_) GCST("T_UNUSED", -1); # else GDFLT("T_UNUSED", 0); # endif #endif #ifdef T_NULL GCST("T_NULL", T_NULL ); #else # if defined(_TLI_) GCST("T_NULL", 0); # else GDFLT("T_NULL", 0); # endif #endif #ifdef T_ABSREQ GCST("T_ABSREQ", T_ABSREQ ); #else # if defined(_TLI_) GCST("T_ABSREQ", 0x8000); # else GDFLT("T_ABSREQ", 0); # endif #endif #ifdef T_INFINITE GCST("T_INFINITE", T_INFINITE ); #else # if defined(_TLI_) GCST("T_INFINITE", -1); # else GDFLT("T_INFINITE", 0); # endif #endif #ifdef T_INVALID GCST("T_INVALID", T_INVALID ); #else # if defined(_TLI_) GCST("T_INVALID", -2); # else GDFLT("T_INVALID", 0); # endif #endif /* XTI-level Options */ gcmnt ("XTI-level Options"); #ifdef XTI_GENERIC GCST("XTI_GENERIC", XTI_GENERIC ); #else # if defined(_TLI_) GCST("XTI_GENERIC", 0xffff); # else GDFLT("XTI_GENERIC", 0); # endif #endif #ifdef XTI_DEBUG GCST("XTI_DEBUG", XTI_DEBUG ); #else # if defined(_TLI_) && defined(SO_DEBUG) GCST("XTI_DEBUG", SO_DEBUG); # else GDFLT("XTI_DEBUG", 0); # endif #endif #ifdef XTI_LINGER GCST("XTI_LINGER", XTI_LINGER ); #else # if defined(_TLI_) && defined(SO_LINGER) GCST("XTI_LINGER", SO_LINGER); # else GDFLT("XTI_LINGER", 0); # endif #endif #ifdef XTI_RCVBUF GCST("XTI_RCVBUF", XTI_RCVBUF ); #else # if defined(_TLI_) && defined(SO_RCVBUF) GCST("XTI_RCVBUF", SO_RCVBUF); # else GDFLT("XTI_RCVBUF", 0); # endif #endif #ifdef XTI_RCVLOWAT GCST("XTI_RCVLOWAT", XTI_RCVLOWAT ); #else # if defined(_TLI_) && defined(SO_RCVLOWAT) GCST("XTI_RCVLOWAT", SO_RCVLOWAT); # else GDFLT("XTI_RCVLOWAT", 0); # endif #endif #ifdef XTI_SNDBUF GCST("XTI_SNDBUF", XTI_SNDBUF ); #else # if defined(_TLI_) && defined(SO_SNDBUF) GCST("XTI_SNDBUF", SO_SNDBUF); # else GDFLT("XTI_SNDBUF", 0); # endif #endif #ifdef XTI_SNDLOWAT GCST("XTI_SNDLOWAT", XTI_SNDLOWAT ); #else # if defined(_TLI_) && defined(SO_SNDLOWAT) GCST("XTI_SNDLOWAT", SO_SNDLOWAT); # else GDFLT("XTI_SNDLOWAT", 0); # endif #endif gcmnt("t_linger structure"); g_struct_t_linger(); gcmnt("General definitions for option management"); #ifdef T_UNSPEC GCST("T_UNSPEC", T_UNSPEC ); #else # if defined(_TLI_) GCST("T_UNSPEC", (~0-2)); # else GDFLT("T_UNSPEC", 0); # endif #endif #ifdef T_ALLOPT GCST("T_ALLOPT", T_ALLOPT ); #else # if defined(_TLI_) GCST("T_ALLOPT", 0); # else GDFLT("T_ALLOPT", 0); # endif #endif gmacrofunc("c_T_ALIGN", "char_ptr", "p"); /* TCP Level and options */ gcmnt("TCP Level and Options"); #ifdef INET_TCP GCST("INET_TCP", INET_TCP); #else GDFLT("INET_TCP",0); #endif #ifdef TCP_NODELAY GCST("TCP_NODELAY", TCP_NODELAY); #else GDFLT("TCP_NODELAY",0); #endif #ifdef TCP_MAXSEG GCST("TCP_MAXSEG", TCP_MAXSEG); #else GDFLT("TCP_MAXSEG",0); #endif #ifdef TCP_KEEPALIVE GCST("TCP_KEEPALIVE", TCP_KEEPALIVE); #else # if defined(_TLI_) && defined (SO_KEEPALIVE) GCST("TCP_KEEPALIVE", SO_KEEPALIVE); # else GDFLT("TCP_KEEPALIVE",0); # endif #endif #ifdef T_GARBAGE GCST("T_GARBAGE", T_GARBAGE); #else # if defined(_TLI_) GCST("T_GARBAGE", 2); # else GDFLT("T_GARBAGE",0); # endif #endif /* UDP Level and options */ gcmnt("UDP Level and Options"); #ifdef INET_UDP GCST("INET_UDP", INET_UDP); #else GDFLT("INET_UDP",0); #endif #ifdef UDP_CHECKSUM GCST("UDP_CHECKSUM", UDP_CHECKSUM); #else GDFLT("UDP_CHECKSUM",0); #endif /* IP Level and Options */ gcmnt("IP Level and Options"); #ifdef INET_IP GCST("INET_IP", INET_IP); #else GDFLT("INET_IP",0); #endif #ifdef IP_OPTIONS GCST("IP_OPTIONS", IP_OPTIONS); #else GDFLT("IP_OPTIONS",0); #endif #ifdef IP_TOS GCST("IP_TOS", IP_TOS); #else GDFLT("IP_TOS",0); #endif #ifdef IP_TTL GCST("IP_TTL", IP_TTL); #else GDFLT("IP_TTL",0); #endif #ifdef IP_REUSEADDR GCST("IP_REUSEADDR", IP_REUSEADDR); #else # if defined(_TLI_) GCST("IP_REUSEADDR", SO_REUSEADDR); # else GDFLT("IP_REUSEADDR",0); # endif #endif #ifdef IP_DONTROUTE GCST("IP_DONTROUTE", IP_DONTROUTE); #else # if defined(_TLI_) GCST("IP_DONTROUTE", SO_DONTROUTE); # else GDFLT("IP_DONTROUTE",0); # endif #endif #ifdef IP_BROADCAST GCST("IP_BROADCAST", IP_BROADCAST); #else # if defined(_TLI_) GCST("IP_BROADCAST", SO_BROADCAST); # else GDFLT("IP_BROADCAST",0); # endif #endif gcmnt("IP_TOS precedence levels"); #ifdef T_ROUTINE GCST("T_ROUTINE", T_ROUTINE); #else GDFLT("T_ROUTINE",0); #endif #ifdef T_PRIORITY GCST("T_PRIORITY", T_PRIORITY); #else GDFLT("T_PRIORITY",0); #endif #ifdef T_IMMEDIATE GCST("T_IMMEDIATE", T_IMMEDIATE); #else GDFLT("T_IMMEDIATE",0); #endif #ifdef T_FLASH GCST("T_FLASH", T_FLASH); #else GDFLT("T_FLASH",0); #endif #ifdef T_OVERRIDEFLASH GCST("T_OVERRIDEFLASH", T_OVERRIDEFLASH); #else GDFLT("T_OVERRIDEFLASH",0); #endif #ifdef T_CRITIC_ECP GCST("T_CRITIC_ECP", T_CRITIC_ECP); #else GDFLT("T_CRITIC_ECP",0); #endif #ifdef T_INETCONTROL GCST("T_INETCONTROL", T_INETCONTROL); #else GDFLT("T_INETCONTROL",0); #endif #ifdef T_NETCONTROL GCST("T_NETCONTROL", T_NETCONTROL); #else GDFLT("T_NETCONTROL",0); #endif gcmnt("IP_TOS type of service"); #ifdef T_NOTOS GCST("T_NOTOS", T_NOTOS); #else GDFLT("T_NOTOS",0); #endif #ifdef T_LDELAY GCST("T_LDELAY", T_LDELAY); #else GDFLT("T_LDELAY",0); #endif #ifdef T_HITHRPT GCST("T_HITHRPT", T_HITHRPT); #else GDFLT("T_HITHRPT",0); #endif #ifdef T_HIREL GCST("T_HIREL", T_HIREL); #else GDFLT("T_HIREL",0); #endif ghdrcmnt("link names for functions"); GFUNC(t_accept, HAVE_t_accept); GFUNC(t_alloc, HAVE_t_accept); GFUNC(t_bind, HAVE_t_bind); GFUNC(t_blocking, HAVE_t_blocking); GFUNC(t_close, HAVE_t_close); GFUNC(t_connect, HAVE_t_connect); GFUNC(t_error, HAVE_t_error); GFUNC(t_free, HAVE_t_free); GFUNC(t_getinfo, HAVE_t_getinfo); GFUNC(t_getprotaddr, HAVE_t_getprotaddr); GFUNC(t_getstate, HAVE_t_getstate); GFUNC(t_listen, HAVE_t_listen); GFUNC(t_look, HAVE_t_look); GFUNC(t_nonblocking, HAVE_t_nonblocking); GFUNC(t_open, HAVE_t_open); GFUNC(t_optmgmt, HAVE_t_optmgmt); GFUNC(t_rcv, HAVE_t_rcv); GFUNC(t_rcvconnect, HAVE_t_rcvconnect); GFUNC(t_rcvdis, HAVE_t_rcvdis); GFUNC(t_rcvrel, HAVE_t_rcvrel); GFUNC(t_rcvreldata, HAVE_t_rcvreldata); GFUNC(t_rcvudata, HAVE_t_rcvudata); GFUNC(t_rcvuderr, HAVE_t_rcvuderr); GFUNC(t_rcvv, HAVE_t_rcvv); GFUNC(t_rcvvudata, HAVE_t_rcvvudata); GFUNC(t_snd, HAVE_t_snd); GFUNC(t_snddis, HAVE_t_snddis); GFUNC(t_sndudata, HAVE_t_sndudata); GFUNC(t_sndrel, HAVE_t_sndrel); GFUNC(t_sndreldata, HAVE_t_sndreldata); GFUNC(t_sndv, HAVE_t_sndv); GFUNC(t_sndvudata, HAVE_t_sndvudata); GFUNC(t_strerror, HAVE_t_strerror); GFUNC(t_sync, HAVE_t_sync); GFUNC(t_unbind, HAVE_t_unbind); fprintf(fp,"\n"); ifprintf(fp,"end XTI;\n"); indent--; /* netinet/in.h ---------------- */ indent++; ifprintf(fp,"package Netinet is\n"); ghdrcmnt("From netinet/in.h"); #ifdef IPPROTO_IP GUCST("IPPROTO_IP", IPPROTO_IP); #else GDFLT("IPPROTO_IP", 0); #endif #ifdef IPPROTO_ICMP GUCST("IPPROTO_ICMP", IPPROTO_ICMP); #else GDFLT("IPPROTO_ICMP", 0); #endif #ifdef IPPROTO_TCP GUCST("IPPROTO_TCP", IPPROTO_TCP); #else GDFLT("IPPROTO_TCP", 0); #endif #ifdef IPPROTO_UDP GUCST("IPPROTO_UDP", IPPROTO_UDP); #else GDFLT("IPPROTO_UDP", 0); #endif #ifdef IPPROTO_RAW GUCST("IPPROTO_RAW", IPPROTO_RAW); #else GDFLT("IPPROTO_RAW", 0); #endif #ifdef IP_OPTIONS GUCST("IP_OPTIONS", IP_OPTIONS); #else GDFLT("IP_OPTIONS", 0); #endif #ifdef IP_HDRINCL GUCST("IP_HDRINCL", IP_HDRINCL); #else GDFLT("IP_HDRINCL", 0); #endif #ifdef IP_TOS GUCST("IP_TOS", IP_TOS); #else GDFLT("IP_TOS", 0); #endif #ifdef IP_TTL GUCST("IP_TTL", IP_TTL); #else GDFLT("IP_TTL", 0); #endif #ifdef IP_RECVDSTADDR GUCST("IP_RECVDSTADDR", IP_RECVDSTADDR); #else GDFLT("IP_RECVDSTADDR", 0); #endif #ifdef INADDR_NONE GUCST("INADDR_NONE", INADDR_NONE); #else GUFLT("INADDR_NONE", 0xffffffff); #endif #ifdef INADDR_ANY GUCST("INADDR_ANY",INADDR_ANY); #else GDFLT("INADDR_ANY",0); #endif #ifdef INADDR_BROADCAST GUCST("INADDR_BROADCAST",INADDR_BROADCAST); #else GDFLT("INADDR_BROADCAST",0); #endif #ifdef INADDR_LOOPBACK GUCST("INADDR_LOOPBACK",INADDR_LOOPBACK); #else GDFLT("INADDR_LOOPBACK",0); #endif #ifdef INADDR_UNSPEC_GROUP GUCST("INADDR_UNSPEC_GROUP",INADDR_UNSPEC_GROUP); #else GDFLT("INADDR_UNSPEC_GROUP",0); #endif #ifdef INADDR_ALLHOSTS_GROUP GUCST("INADDR_ALLHOSTS_GROUP",INADDR_ALLHOSTS_GROUP); #else GDFLT("INADDR_ALLHOSTS_GROUP",0); #endif #ifdef INADDR_MAX_LOCAL_GROUP GUCST("INADDR_MAX_LOCAL_GROUP",INADDR_MAX_LOCAL_GROUP); #else GDFLT("INADDR_MAX_LOCAL_GROUP",0); #endif GFUNC(inet_addr, HAVE_inet_addr); GFUNC(inet_makeaddr, HAVE_inet_makeaddr); GFUNC(inet_network, HAVE_inet_network); GFUNC(inet_lnaof, HAVE_inet_lnaof); GFUNC(inet_netof, HAVE_inet_netof); GFUNC(inet_ntoa, HAVE_inet_ntoa); ghdrcmnt("From netinet/tcp.h"); #ifdef TCP_NODELAY GCST("TCP_NODELAY", TCP_NODELAY); #else GDFLT("TCP_NODELAY",0); #endif #ifdef TCP_MAXSEG GCST("TCP_MAXSEG", TCP_MAXSEG); #else GDFLT("TCP_MAXSEG",0); #endif #ifdef TCP_KEEPALIVE GCST("TCP_KEEPALIVE", TCP_KEEPALIVE); #else GDFLT("TCP_KEEPALIVE",0); #endif #ifdef TCP_MAXRXT GCST("TCP_MAXRXT", TCP_MAXRXT); #else GDFLT("TCP_MAXRXT",0); #endif #ifdef TCP_STDURG GCST("TCP_STDURG", TCP_STDURG); #else GDFLT("TCP_STDURG",0); #endif ghdrcmnt("From netinet/ip.h"); #ifdef IPTOS_LOWDELAY GCST("IPTOS_LOWDELAY", IPTOS_LOWDELAY); #else GDFLT("IPTOS_LOWDELAY",0); #endif #ifdef IPTOS_THROUGHPUT GCST("IPTOS_THROUGHPUT", IPTOS_THROUGHPUT); #else GDFLT("IPTOS_THROUGHPUT",0); #endif #ifdef IPTOS_RELIABILITY GCST("IPTOS_RELIABILITY", IPTOS_RELIABILITY); #else GDFLT("IPTOS_RELIABILITY",0); #endif fprintf(fp,"\n"); ifprintf(fp,"end Netinet;\n"); indent--; /* netdb.h ---------------- */ indent++; ifprintf(fp,"package NetDB is\n"); ifprintf(fp," use Sockets;\n"); g_struct_netent(); gcmnt("protocol database entry"); g_struct_protoent(); gcmnt("local socket address"); GFUNC(endhostent, HAVE_endhostent); GFUNC(endnetent, HAVE_endnetent); GFUNC(endprotoent, HAVE_endprotoent); GFUNC(endservent, HAVE_endservent); /* Assume the following three are always there, since if getaddrinfo is not implemented we will provide our own freeware version. */ GFUNC(getaddrinfo, 1); GFUNC(freeaddrinfo, 1); GFUNC(getnameinfo, 1); GFUNC(gethostbyaddr, HAVE_gethostbyaddr); GFUNC(gethostbyaddr_r, HAVE_gethostbyaddr_r); GFUNC(gethostbyname, HAVE_gethostbyname); GFUNC(gethostbyname_r, HAVE_gethostbyname_r); GFUNC(gethostname, HAVE_gethostname); GFUNC(getnetbyaddr, HAVE_getnetbyaddr); GFUNC(getnetbyaddr_r, HAVE_getnetbyaddr_r); GFUNC(getnetbyname, HAVE_getnetbyname); GFUNC(getnetbyname_r, HAVE_getnetbyname_r); GFUNC(getpeername, HAVE_getpeername); GFUNC(getprotobyname, HAVE_getprotobyname); GFUNC(getprotobyname_r, HAVE_getprotobyname_r); GFUNC(getprotobynumber, HAVE_getprotobynumber); GFUNC(getprotobynumber_r, HAVE_getprotobynumber_r); GFUNC(getservbyname, HAVE_getservbyname); GFUNC(getservbyname_r, HAVE_getservbyname_r); GFUNC(getservbyport, HAVE_getservbyport); GFUNC(getservbyport_r, HAVE_getservbyport_r); GFUNC(sethostent, HAVE_sethostent); GFUNC(setnetent, HAVE_setnetent); GFUNC(setprotoent, HAVE_setprotoent); GFUNC(setservent, HAVE_setservent); fprintf(fp,"\n"); ifprintf(fp,"end NetDB;\n"); indent--; /* * Poll/Select */ gcmnt("pollfd structure"); g_struct_pollfd(); ifprintf(fp, " type fd_mask_array is array (Integer range <>) of unsigned_int;\n"); gcmnt("fd_set structure"); g_fd_set(); #ifdef FD_SETSIZE GCST("FD_SETSIZE", FD_SETSIZE); #else GDFLT("FD_SETSIZE",0); #endif #ifdef INFTIM GCST("INFTIM", INFTIM); #else GDFLT("INFTIM",0); #endif #ifdef POLLIN GCST("POLLIN", POLLIN); #else GDFLT("POLLIN",0); #endif #ifdef POLLRDNORM GCST("POLLRDNORM", POLLRDNORM); #else GDFLT("POLLRDNORM",0); #endif #ifdef POLLRDBAND GCST("POLLRDBAND", POLLRDBAND); #else GDFLT("POLLRDBAND",0); #endif #ifdef POLLPRI GCST("POLLPRI", POLLPRI); #else GDFLT("POLLPRI",0); #endif #ifdef POLLWRNORM GCST("POLLWRNORM", POLLWRNORM); #else GDFLT("POLLWRNORM",0); #endif #ifdef POLLWRBAND GCST("POLLWRBAND", POLLWRBAND); #else GDFLT("POLLWRBAND",0); #endif #ifdef POLLERR GCST("POLLERR", POLLERR); #else GDFLT("POLLERR",0); #endif #ifdef POLLNVAL GCST("POLLNVAL", POLLNVAL); #else GDFLT("POLLNVAL",0); #endif GFUNC(poll, HAVE_poll); GFUNC(select, HAVE_select); fprintf(fp,"\n"); ifprintf(fp,"end POSIX.C;\n"); fclose(fp); fprintf(stderr,"done generating posix-c.ads\n"); } /* end create_c */ /* main ---- */ int main() { /* Figure out the number of bits in a byte. */ { unsigned char b; bits_per_byte = 0; b = 1; while (b) { bits_per_byte++; b = b << 1; } } if (bits_per_byte != 8) { quit("byte-size is not equal to 8\n",""); } create_options(); create_limits(); create_posix(); create_c(); return 0; } florist-gpl-2017-src/libsrc/0000755000076700001450000000000013106553470015271 5ustar gnatmailgnatflorist-gpl-2017-src/libsrc/posix-shared_memory_objects.adb0000644000076700001450000001377613106553472023470 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . S H A R E D _ M E M O R Y _ O B J E C T S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2010, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.Implementation, POSIX.Permissions.Implementation, Unchecked_Conversion; package body POSIX.Shared_Memory_Objects is use POSIX.C; use POSIX.Implementation; use POSIX.Permissions.Implementation; function To_int is new Unchecked_Conversion (Bits, int); C_File_Mode : constant array (POSIX.IO.File_Mode) of Bits := (POSIX.IO.Read_Only => O_RDONLY, POSIX.IO.Write_Only => O_WRONLY, POSIX.IO.Read_Write => O_RDWR); -------------------------- -- Open_Shared_Memory -- -------------------------- function shm_open (name : char_ptr; oflag : int; mode : mode_t) return int; pragma Import (C, shm_open, shm_open_LINKNAME); function Open_Shared_Memory (Name : POSIX.POSIX_String; Mode : POSIX.IO.File_Mode; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return POSIX.IO.File_Descriptor is Old_Mask : aliased Signal_Mask; Name_With_NUL : POSIX_String := Name & NUL; Result : POSIX.IO.File_Descriptor; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := POSIX.IO.File_Descriptor (Check (shm_open (Name_With_NUL (Name_With_NUL'First)'Unchecked_Access, To_int (Option_Set (Options).Option or C_File_Mode (Mode)), 0), Old_Mask'Unchecked_Access)); Check_NNeg_And_Restore_Signals (int (Result), Masked_Signals, Old_Mask'Unchecked_Access); return Result; end Open_Shared_Memory; ------------------------------------ -- Open_Or_Create_Shared_Memory -- ------------------------------------ function Open_Or_Create_Shared_Memory (Name : POSIX.POSIX_String; Mode : POSIX.IO.File_Mode; Permissions : POSIX.Permissions.Permission_Set; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return POSIX.IO.File_Descriptor is Old_Mask : aliased Signal_Mask; Name_With_NUL : POSIX_String := Name & NUL; Result : POSIX.IO.File_Descriptor; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := POSIX.IO.File_Descriptor (Check (shm_open (Name_With_NUL (Name_With_NUL'First)'Unchecked_Access, To_int (Option_Set (Options).Option or C_File_Mode (Mode) or O_CREAT), Form_C_Permission (Permissions)), Old_Mask'Unchecked_Access)); Check_NNeg_And_Restore_Signals (int (Result), Masked_Signals, Old_Mask'Unchecked_Access); return Result; end Open_Or_Create_Shared_Memory; ---------------------------- -- Unlink_Shared_Memory -- ---------------------------- procedure Unlink_Shared_Memory (Name : POSIX.POSIX_String) is Name_With_NUL : POSIX_String := Name & NUL; function shm_unlink (name : char_ptr) return int; pragma Import (C, shm_unlink, shm_unlink_LINKNAME); begin Check (shm_unlink (Name_With_NUL (Name_With_NUL'First)'Unchecked_Access)); end Unlink_Shared_Memory; end POSIX.Shared_Memory_Objects; florist-gpl-2017-src/libsrc/posix_io.ads0000644000076700001450000000556013106553472017623 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ I O -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.IO; pragma Elaborate_All (POSIX.IO); package POSIX_IO renames POSIX.IO; florist-gpl-2017-src/libsrc/posix-memory_range_locking.ads0000644000076700001450000000603713106553472023324 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . M E M O R Y _ R A N G E _ L O C K I N G -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with System, System.Storage_Elements; package POSIX.Memory_Range_Locking is procedure Lock_Range (First : System.Address; Length : System.Storage_Elements.Storage_Offset); procedure Unlock_Range (First : System.Address; Length : System.Storage_Elements.Storage_Offset); end POSIX.Memory_Range_Locking; florist-gpl-2017-src/libsrc/posix-terminal_functions.adb0000644000076700001450000005251613106553472023017 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . T E R M I N A L _ F U N C T I O N S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation, Unchecked_Conversion; package body POSIX.Terminal_Functions is use POSIX.C, POSIX.Implementation; ------------------------- -- Local Subprograms -- ------------------------- procedure Validate (Characteristics : Terminal_Characteristics); function To_Ada_Baud (Val : speed_t) return Baud_Rate; procedure Validate (Characteristics : Terminal_Characteristics) is begin Check (Characteristics.Valid, Invalid_Argument); end Validate; pragma Inline (Validate); function To_Ada_Baud (Val : speed_t) return Baud_Rate is begin if Val = POSIX.C.B0 then return B0; end if; if Val = POSIX.C.B50 then return B50; end if; if Val = POSIX.C.B75 then return B75; end if; if Val = POSIX.C.B110 then return B110; end if; if Val = POSIX.C.B134 then return B134; end if; if Val = POSIX.C.B150 then return B150; end if; if Val = POSIX.C.B200 then return B200; end if; if Val = POSIX.C.B300 then return B300; end if; if Val = POSIX.C.B600 then return B600; end if; if Val = POSIX.C.B1200 then return B1200; end if; if Val = POSIX.C.B1800 then return B1800; end if; if Val = POSIX.C.B2400 then return B2400; end if; if Val = POSIX.C.B4800 then return B4800; end if; if Val = POSIX.C.B9600 then return B9600; end if; if Val = POSIX.C.B19200 then return B19200; end if; if Val = POSIX.C.B38400 then return B38400; end if; if Val = POSIX.C.B57600 then return B57600; end if; if Val = POSIX.C.B115200 then return B115200; end if; if Val = POSIX.C.B230400 then return B230400; end if; if Val = POSIX.C.B460800 then return B460800; end if; Raise_POSIX_Error (Invalid_Argument); -- fake return to avoid compiler warning message return B38400; end To_Ada_Baud; ---------------------------------- -- Get_Terminal_Characteristics -- ---------------------------------- function tcgetattr (fd : int; pt : access struct_termios) return int; pragma Import (C, tcgetattr, tcgetattr_LINKNAME); function Get_Terminal_Characteristics (File : POSIX.IO.File_Descriptor) return Terminal_Characteristics is Pt : Terminal_Characteristics; begin Pt.Valid := True; Check (tcgetattr (int (File), Pt.termios'Unchecked_Access)); return Pt; end Get_Terminal_Characteristics; ---------------------------------- -- Set_Terminal_Characteristics -- ---------------------------------- To_C_Times : constant array (Terminal_Action_Times) of int := (Immediately => TCSANOW, After_Output => TCSADRAIN, After_Output_And_Input => TCSAFLUSH); function tcsetattr (fd : int; action : int; pt : termios_ptr) return int; pragma Import (C, tcsetattr, tcsetattr_LINKNAME); procedure Set_Terminal_Characteristics (File : POSIX.IO.File_Descriptor; Characteristics : Terminal_Characteristics; Apply : Terminal_Action_Times := Immediately; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) is Old_Mask : aliased Signal_Mask; Result : int; begin Validate (Characteristics); Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := tcsetattr (int (File), To_C_Times (Apply), Characteristics.termios'Unchecked_Access); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Set_Terminal_Characteristics; ----------------------- -- Terminal_Modes_Of -- ----------------------- To_C_Terminal_Mode : constant array (Terminal_Modes) of tcflag_t := ( -- Input_Modes Interrupt_On_Break => BRKINT, Map_CR_To_LF => ICRNL, Ignore_Break => IGNBRK, Ignore_CR => IGNCR, Ignore_Parity_Errors => IGNPAR, Map_LF_To_CR => INLCR, Enable_Parity_Check => INPCK, Strip_Character => ISTRIP, Enable_Start_Stop_Input => IXOFF, Enable_Start_Stop_Output => IXON, Mark_Parity_Errors => PARMRK, -- Output_Modes Perform_Output_Processing => OPOST, -- Control_Modes Ignore_Modem_Status => CLOCAL, Enable_Receiver => CREAD, Send_Two_Stop_Bits => CSTOPB, Hang_Up_On_Last_Close => HUPCL, Parity_Enable => PARENB, Odd_Parity => PARODD, -- Local_Modes Echo => POSIX.C.ECHO, Echo_Erase => ECHOE, Echo_Kill => ECHOK, Echo_LF => ECHONL, Canonical_Input => ICANON, Extended_Functions => IEXTEN, Enable_Signals => ISIG, No_Flush => NOFLSH, Send_Signal_For_BG_Output => TOSTOP); i_mask : constant tcflag_t := BRKINT or ICRNL or IGNBRK or IGNCR or IGNPAR or INLCR or INPCK or ISTRIP or IXOFF or IXON or PARMRK; o_mask : constant tcflag_t := OPOST; c_mask : constant tcflag_t := CLOCAL or CREAD or CSTOPB or HUPCL or PARENB or PARODD; l_mask : constant tcflag_t := POSIX.C.ECHO or ECHOE or ECHOK or ECHONL or ICANON or IEXTEN or ISIG or NOFLSH or TOSTOP; function Terminal_Modes_Of (Characteristics : Terminal_Characteristics) return Terminal_Modes_Set is Modes : Terminal_Modes_Set := (others => False); begin Validate (Characteristics); for I in Input_Modes loop if (Characteristics.termios.c_iflag and To_C_Terminal_Mode (I)) /= 0 then Modes (I) := True; end if; end loop; for I in Output_Modes loop if (Characteristics.termios.c_oflag and To_C_Terminal_Mode (I)) /= 0 then Modes (I) := True; end if; end loop; for I in Control_Modes loop if (Characteristics.termios.c_cflag and To_C_Terminal_Mode (I)) /= 0 then Modes (I) := True; end if; end loop; for I in Local_Modes loop if (Characteristics.termios.c_lflag and To_C_Terminal_Mode (I)) /= 0 then Modes (I) := True; end if; end loop; return Modes; end Terminal_Modes_Of; --------------------------- -- Define_Terminal_Modes -- --------------------------- procedure Define_Terminal_Modes (Characteristics : in out Terminal_Characteristics; Modes : Terminal_Modes_Set) is Tmp : tcflag_t; begin Validate (Characteristics); Tmp := 0; for I in Input_Modes loop if Modes (I) then Tmp := Tmp or To_C_Terminal_Mode (I); end if; end loop; Characteristics.termios.c_iflag := (Characteristics.termios.c_iflag and not i_mask) or Tmp; Tmp := 0; for I in Output_Modes loop if Modes (I) then Tmp := Tmp or To_C_Terminal_Mode (I); end if; end loop; Characteristics.termios.c_oflag := (Characteristics.termios.c_oflag and not o_mask) or Tmp; Tmp := 0; for I in Control_Modes loop if Modes (I) then Tmp := Tmp or To_C_Terminal_Mode (I); end if; end loop; Characteristics.termios.c_cflag := (Characteristics.termios.c_cflag and not c_mask) or Tmp; Tmp := 0; for I in Local_Modes loop if Modes (I) then Tmp := Tmp or To_C_Terminal_Mode (I); end if; end loop; Characteristics.termios.c_lflag := (Characteristics.termios.c_lflag and not l_mask) or Tmp; end Define_Terminal_Modes; --------------------------- -- Bits_Per_Character_Of -- --------------------------- function Bits_Per_Character_Of (Characteristics : Terminal_Characteristics) return Bits_Per_Character is csize_bits : constant tcflag_t := Characteristics.termios.c_cflag and CSIZE; begin Validate (Characteristics); if csize_bits = CS5 then return 5; end if; if csize_bits = CS6 then return 6; end if; if csize_bits = CS7 then return 7; end if; if csize_bits = CS8 then return 8; end if; Raise_POSIX_Error (Invalid_Argument); -- fake return to avoid compiler warning message return 8; end Bits_Per_Character_Of; ------------------------------- -- Define_Bits_Per_Character -- ------------------------------- To_C_Bits : constant array (Bits_Per_Character) of tcflag_t := (5 => CS5, 6 => CS6, 7 => CS7, 8 => CS8); procedure Define_Bits_Per_Character (Characteristics : in out Terminal_Characteristics; Bits : Bits_Per_Character) is begin Validate (Characteristics); Characteristics.termios.c_cflag := (Characteristics.termios.c_cflag and not CSIZE) or To_C_Bits (Bits); end Define_Bits_Per_Character; ------------------------ -- Input_Baud_Rate_Of -- ------------------------ function cfgetispeed (termios_p : termios_ptr) return speed_t; pragma Import (C, cfgetispeed, cfgetispeed_LINKNAME); function Input_Baud_Rate_Of (Characteristics : Terminal_Characteristics) return Baud_Rate is begin Validate (Characteristics); return To_Ada_Baud (cfgetispeed (Characteristics.termios'Unchecked_Access)); end Input_Baud_Rate_Of; ---------------------------- -- Define_Input_Baud_Rate -- ---------------------------- To_C_Baud : constant array (Baud_Rate) of speed_t := (B0 => POSIX.C.B0, B50 => POSIX.C.B50, B75 => POSIX.C.B75, B110 => POSIX.C.B110, B134 => POSIX.C.B134, B150 => POSIX.C.B150, B200 => POSIX.C.B200, B300 => POSIX.C.B300, B600 => POSIX.C.B600, B1200 => POSIX.C.B1200, B1800 => POSIX.C.B1800, B2400 => POSIX.C.B2400, B4800 => POSIX.C.B4800, B9600 => POSIX.C.B9600, B19200 => POSIX.C.B19200, B38400 => POSIX.C.B38400, B57600 => POSIX.C.B57600, B115200 => POSIX.C.B115200, B230400 => POSIX.C.B230400, B460800 => POSIX.C.B460800); function cfsetispeed (termios_p : termios_ptr; speed : speed_t) return int; pragma Import (C, cfsetispeed, cfsetispeed_LINKNAME); procedure Define_Input_Baud_Rate (Characteristics : in out Terminal_Characteristics; Input_Baud_Rate : Baud_Rate) is begin Validate (Characteristics); Check (cfsetispeed (Characteristics.termios'Unchecked_Access, To_C_Baud (Input_Baud_Rate))); end Define_Input_Baud_Rate; ------------------------- -- Output_Baud_Rate_Of -- ------------------------- function cfgetospeed (termios_p : termios_ptr) return speed_t; pragma Import (C, cfgetospeed, cfgetospeed_LINKNAME); function Output_Baud_Rate_Of (Characteristics : Terminal_Characteristics) return Baud_Rate is begin Validate (Characteristics); return To_Ada_Baud (cfgetospeed (Characteristics.termios'Unchecked_Access)); end Output_Baud_Rate_Of; ----------------------------- -- Define_Output_Baud_Rate -- ----------------------------- function cfsetospeed (termios_p : termios_ptr; speed : speed_t) return int; pragma Import (C, cfsetospeed, cfsetospeed_LINKNAME); procedure Define_Output_Baud_Rate (Characteristics : in out Terminal_Characteristics; Output_Baud_Rate : Baud_Rate) is begin Validate (Characteristics); Check (cfsetospeed (Characteristics.termios'Unchecked_Access, To_C_Baud (Output_Baud_Rate))); end Define_Output_Baud_Rate; ---------------------------------- -- Special_Control_Character_Of -- ---------------------------------- To_Integer : constant array (Control_Character_Selector) of Integer := (EOF_Char => VEOF, EOL_Char => VEOL, Erase_Char => VERASE, Interrupt_Char => VINTR, Kill_Char => VKILL, Quit_Char => VQUIT, Suspend_Char => VSUSP, Start_Char => VSTART, Stop_Char => VSTOP); function Special_Control_Character_Of (Characteristics : Terminal_Characteristics; Selector : Control_Character_Selector) return POSIX.POSIX_Character is begin return POSIX.POSIX_Character'Val (Characteristics.termios.c_cc (To_Integer (Selector))); end Special_Control_Character_Of; -------------------------------------- -- Define_Special_Control_Character -- -------------------------------------- procedure Define_Special_Control_Character (Characteristics : in out Terminal_Characteristics; Selector : Control_Character_Selector; Char : POSIX.POSIX_Character) is begin Validate (Characteristics); Characteristics.termios.c_cc (To_Integer (Selector)) := cc_t (POSIX.POSIX_Character'Pos (Char)); end Define_Special_Control_Character; ------------------------------- -- Disable_Control_Character -- ------------------------------- procedure Disable_Control_Character (Characteristics : in out Terminal_Characteristics; Selector : Control_Character_Selector) is begin Characteristics.termios.c_cc (To_Integer (Selector)) := 0; end Disable_Control_Character; ------------------- -- Input_Time_Of -- ------------------- function Input_Time_Of (Characteristics : Terminal_Characteristics) return Duration is begin Validate (Characteristics); return Duration (Characteristics.termios.c_cc (VTIME)) / 10.0; end Input_Time_Of; ----------------------- -- Define_Input_Time -- ----------------------- procedure Define_Input_Time (Characteristics : in out Terminal_Characteristics; Input_Time : Duration) is begin Validate (Characteristics); if Input_Time < 0.0 or else Input_Time > Duration (cc_t'Last) / 10.0 then Raise_POSIX_Error (Invalid_Argument); end if; Characteristics.termios.c_cc (VTIME) := cc_t (Input_Time * 10); end Define_Input_Time; ---------------------------- -- Minimum_Input_Count_Of -- ---------------------------- function Minimum_Input_Count_Of (Characteristics : Terminal_Characteristics) return Natural is begin Validate (Characteristics); return Natural (Characteristics.termios.c_cc (VMIN)); end Minimum_Input_Count_Of; -------------------------------- -- Define_Minimum_Input_Count -- -------------------------------- procedure Define_Minimum_Input_Count (Characteristics : in out Terminal_Characteristics; Minimum_Input_Count : Natural) is begin Validate (Characteristics); Check (Minimum_Input_Count <= Natural (cc_t'Last), Invalid_Argument); Characteristics.termios.c_cc (VMIN) := cc_t (Minimum_Input_Count); end Define_Minimum_Input_Count; ---------------- -- Send_Break -- ---------------- function tcsendbreak (fd : int; dur : int) return int; pragma Import (C, tcsendbreak, tcsendbreak_LINKNAME); procedure Send_Break (File : POSIX.IO.File_Descriptor; The_Duration : Duration := 0.0) is Num : Float; begin Num := Float (The_Duration); Check (tcsendbreak (int (File), int (Num / 0.25))); end Send_Break; ----------- -- Drain -- ----------- function tcdrain (fd : int) return int; pragma Import (C, tcdrain, tcdrain_LINKNAME); procedure Drain (File : POSIX.IO.File_Descriptor; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) is Old_Mask : aliased Signal_Mask; Result : int; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := tcdrain (int (File)); Restore_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Check (Result); end Drain; ------------------ -- Discard_Data -- ------------------ To_C_Queue : constant array (Queue_Selector) of int := (Received_But_Not_Read => TCIFLUSH, Written_But_Not_Transmitted => TCOFLUSH, Both => TCIOFLUSH); function tcflush (fd : int; action : int) return int; pragma Import (C, tcflush, tcflush_LINKNAME); procedure Discard_Data (File : POSIX.IO.File_Descriptor; Selector : Queue_Selector) is begin Check (tcflush (int (File), To_C_Queue (Selector))); end Discard_Data; ---------- -- Flow -- ---------- To_C_Flow_Action : constant array (Flow_Action) of int := (Suspend_Output => TCOOFF, Restart_Output => TCOON, Transmit_Stop => TCIOFF, Transmit_Start => TCION); function tcflow (fd : int; action : int) return int; pragma Import (C, tcflow, tcflow_LINKNAME); procedure Flow (File : POSIX.IO.File_Descriptor; Action : Flow_Action) is begin Check (tcflow (int (File), To_C_Flow_Action (Action))); end Flow; -------------------------- -- Get_Process_Group_ID -- -------------------------- function tcgetpgrp (fd : int) return pid_t; pragma Import (C, tcgetpgrp, tcgetpgrp_LINKNAME); function To_Process_Group_ID is new Unchecked_Conversion (pid_t, POSIX.Process_Identification.Process_Group_ID); function Get_Process_Group_ID (File : POSIX.IO.File_Descriptor) return POSIX.Process_Identification.Process_Group_ID is Result : pid_t; begin Result := tcgetpgrp (int (File)); if Result = -1 then Raise_POSIX_Error; end if; return To_Process_Group_ID (Result); end Get_Process_Group_ID; -------------------------- -- Set_Process_Group_ID -- -------------------------- function tcsetpgrp (fd : int; pgrp : pid_t) return int; pragma Import (C, tcsetpgrp, tcsetpgrp_LINKNAME); function To_pid_t is new Unchecked_Conversion (POSIX.Process_Identification.Process_Group_ID, pid_t); procedure Set_Process_Group_ID (File : POSIX.IO.File_Descriptor; Group_ID : POSIX.Process_Identification.Process_Group_ID) is begin Check (tcsetpgrp (int (File), To_pid_t (Group_ID))); end Set_Process_Group_ID; ----------------------------------- -- Get_Controlling_Terminal_Name -- ----------------------------------- function ctermid (s : char_ptr) return char_ptr; pragma Import (C, ctermid, ctermid_LINKNAME); function Get_Controlling_Terminal_Name return POSIX.Pathname is Result : POSIX_String (1 .. L_ctermid); begin return Form_POSIX_String (ctermid (Result (1)'Unchecked_Access)); end Get_Controlling_Terminal_Name; end POSIX.Terminal_Functions; florist-gpl-2017-src/libsrc/posix-configurable_file_limits.adb0000644000076700001450000003552513106553472024135 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . C O N F I G U R A B L E _ F I L E _ L I M I T S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.Implementation; package body POSIX.Configurable_File_Limits is use POSIX.C; use POSIX.Implementation; ------------------------- -- Local Subprograms -- ------------------------- function pathconf (path : char_ptr; name : int) return long; pragma Import (C, pathconf, pathconf_LINKNAME); function fpathconf (fd : int; name : int) return long; pragma Import (C, fpathconf, fpathconf_LINKNAME); function Is_Limited (Pathname : POSIX.Pathname; PC_Code : int) return Boolean; function Is_Limited (File : POSIX.IO.File_Descriptor; PC_Code : int) return Boolean; function Is_Supported (Pathname : POSIX.Pathname; PC_Code : int) return Boolean; function Is_Supported (File : POSIX.IO.File_Descriptor; PC_Code : int) return Boolean; function Limit (Pathname : POSIX.Pathname; PC_Code : int; Default_Maximum : long) return long; function Limit (File : POSIX.IO.File_Descriptor; PC_Code : int; Default_Maximum : long) return long; function Is_Limited (Pathname : POSIX.Pathname; PC_Code : int) return Boolean is Pathname_With_NUL : POSIX_String := Pathname & NUL; begin Store_Errno (0); -- -1 without errno unchanged -> no limit -- -1 with errno -> bad name or other error -- other values -> there exists a limit if pathconf (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, PC_Code) = -1 then if Fetch_Errno /= 0 then Raise_POSIX_Error; end if; return False; else return True; end if; end Is_Limited; function Is_Limited (File : POSIX.IO.File_Descriptor; PC_Code : int) return Boolean is begin Store_Errno (0); if fpathconf (int (File), PC_Code) = -1 then if Fetch_Errno /= 0 then Raise_POSIX_Error; end if; return False; else return True; end if; end Is_Limited; function Limit (Pathname : POSIX.Pathname; PC_Code : int; Default_Maximum : long) return long is Pathname_With_NUL : POSIX_String := Pathname & NUL; Result : long; begin Result := pathconf (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, PC_Code); if Result = -1 then if Fetch_Errno /= 0 then Raise_POSIX_Error; end if; return Default_Maximum; else return Result; end if; end Limit; function Limit (File : POSIX.IO.File_Descriptor; PC_Code : int; Default_Maximum : long) return long is Result : long; begin Result := fpathconf (int (File), PC_Code); if Result = -1 then if Fetch_Errno /= 0 then Raise_POSIX_Error; end if; return Default_Maximum; else return Result; end if; end Limit; function Is_Supported (Pathname : POSIX.Pathname; PC_Code : int) return Boolean is Pathname_With_NUL : POSIX_String := Pathname & NUL; begin return pathconf (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, PC_Code) /= 0; end Is_Supported; function Is_Supported (File : POSIX.IO.File_Descriptor; PC_Code : int) return Boolean is begin return fpathconf (int (File), PC_Code) /= 0; end Is_Supported; ------------------- -- Link Limits -- ------------------- function Link_Is_Limited (Pathname : POSIX.Pathname) return Boolean is begin return Is_Limited (Pathname, PC_LINK_MAX); end Link_Is_Limited; function Link_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean is begin return Is_Limited (File, PC_LINK_MAX); end Link_Is_Limited; function Link_Limit (Pathname : POSIX.Pathname) return Link_Limit_Maxima is begin return Link_Limit_Maxima (Limit (Pathname, PC_LINK_MAX, long (Link_Limit_Maxima'Last))); end Link_Limit; function Link_Limit (File : POSIX.IO.File_Descriptor) return Link_Limit_Maxima is begin return Link_Limit_Maxima (Limit (File, PC_LINK_MAX, long (Link_Limit_Maxima'Last))); end Link_Limit; ------------------------ -- Input Line Limits -- ------------------------ function Input_Line_Is_Limited (Pathname : POSIX.Pathname) return Boolean is begin return Is_Limited (Pathname, PC_MAX_CANON); end Input_Line_Is_Limited; function Input_Line_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean is begin return Is_Limited (File, PC_MAX_CANON); end Input_Line_Is_Limited; function Input_Line_Limit (Pathname : POSIX.Pathname) return Input_Line_Limit_Maxima is begin return Input_Line_Limit_Maxima (Limit (Pathname, PC_MAX_CANON, long (Input_Line_Limit_Maxima'Last))); end Input_Line_Limit; function Input_Line_Limit (File : POSIX.IO.File_Descriptor) return Input_Line_Limit_Maxima is begin return Input_Line_Limit_Maxima (Limit (File, PC_MAX_CANON, long (Input_Line_Limit_Maxima'Last))); end Input_Line_Limit; ------------------------- -- Input Queue Limits -- ------------------------- function Input_Queue_Is_Limited (Pathname : POSIX.Pathname) return Boolean is begin return Is_Limited (Pathname, PC_MAX_INPUT); end Input_Queue_Is_Limited; function Input_Queue_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean is begin return Is_Limited (File, PC_MAX_INPUT); end Input_Queue_Is_Limited; function Input_Queue_Limit (Pathname : POSIX.Pathname) return Input_Queue_Limit_Maxima is begin return Input_Queue_Limit_Maxima (Limit (Pathname, PC_MAX_INPUT, long (Input_Queue_Limit_Maxima'Last))); end Input_Queue_Limit; function Input_Queue_Limit (File : POSIX.IO.File_Descriptor) return Input_Queue_Limit_Maxima is begin return Input_Queue_Limit_Maxima (Limit (File, PC_MAX_INPUT, long (Input_Queue_Limit_Maxima'Last))); end Input_Queue_Limit; ------------------------------------ -- Filename And Pathname Limits -- ------------------------------------ function Filename_Is_Limited (Pathname : POSIX.Pathname) return Boolean is begin return Is_Limited (Pathname, PC_NAME_MAX); end Filename_Is_Limited; function Filename_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean is begin return Is_Limited (File, PC_NAME_MAX); end Filename_Is_Limited; function Filename_Limit (Pathname : POSIX.Pathname) return Filename_Limit_Maxima is begin return Filename_Limit_Maxima (Limit (Pathname, PC_NAME_MAX, long (Filename_Limit_Maxima'Last))); end Filename_Limit; function Filename_Limit (File : POSIX.IO.File_Descriptor) return Filename_Limit_Maxima is begin return Filename_Limit_Maxima (Limit (File, PC_NAME_MAX, long (Filename_Limit_Maxima'Last))); end Filename_Limit; function Pathname_Is_Limited (Pathname : POSIX.Pathname) return Boolean is begin return Is_Limited (Pathname, PC_PATH_MAX); end Pathname_Is_Limited; function Pathname_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean is begin return Is_Limited (File, PC_PATH_MAX); end Pathname_Is_Limited; function Pathname_Limit (Pathname : POSIX.Pathname) return Pathname_Limit_Maxima is begin return Pathname_Limit_Maxima (Limit (Pathname, PC_PATH_MAX, long (Pathname_Limit_Maxima'Last))); end Pathname_Limit; function Pathname_Limit (File : POSIX.IO.File_Descriptor) return Pathname_Limit_Maxima is begin return Pathname_Limit_Maxima (Limit (File, PC_PATH_MAX, long (Pathname_Limit_Maxima'Last))); end Pathname_Limit; -------------------------- -- Pipe Length Limits -- -------------------------- function Pipe_Length_Is_Limited (Pathname : POSIX.Pathname) return Boolean is begin return Is_Limited (Pathname, PC_PIPE_BUF); end Pipe_Length_Is_Limited; function Pipe_Length_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean is begin return Is_Limited (File, PC_PIPE_BUF); end Pipe_Length_Is_Limited; function Pipe_Length_Limit (Pathname : POSIX.Pathname) return Pipe_Limit_Maxima is begin return Pipe_Limit_Maxima (Limit (Pathname, PC_PIPE_BUF, long (Pipe_Limit_Maxima'Last))); end Pipe_Length_Limit; function Pipe_Length_Limit (File : POSIX.IO.File_Descriptor) return Pipe_Limit_Maxima is begin return Pipe_Limit_Maxima (Limit (File, PC_PIPE_BUF, long (Pipe_Limit_Maxima'Last))); end Pipe_Length_Limit; -------------------------------- -- Change Owner Restriction -- -------------------------------- function Change_Owner_Is_Restricted (Pathname : POSIX.Pathname) return Change_Owner_Restriction is begin return Is_Supported (Pathname, PC_CHOWN_RESTRICTED); end Change_Owner_Is_Restricted; function Change_Owner_Is_Restricted (File : POSIX.IO.File_Descriptor) return Change_Owner_Restriction is begin return Is_Supported (File, PC_CHOWN_RESTRICTED); end Change_Owner_Is_Restricted; --------------------------- -- Filename Truncation -- --------------------------- function Filename_Is_Truncated (Pathname : POSIX.Pathname) return Filename_Truncation is begin return Is_Supported (Pathname, PC_NO_TRUNC); end Filename_Is_Truncated; function Filename_Is_Truncated (File : POSIX.IO.File_Descriptor) return Filename_Truncation is begin return Is_Supported (File, PC_NO_TRUNC); end Filename_Is_Truncated; ----------------------- -- Synchronized IO -- ----------------------- function Synchronized_IO_Is_Supported (Pathname : POSIX.Pathname) return Boolean is begin return Is_Supported (Pathname, PC_SYNC_IO); end Synchronized_IO_Is_Supported; function Synchronized_IO_Is_Supported (File : POSIX.IO.File_Descriptor) return Boolean is begin return Is_Supported (File, PC_SYNC_IO); end Synchronized_IO_Is_Supported; ----------------------- -- Asynchronous IO -- ----------------------- function Asynchronous_IO_Is_Supported (Pathname : POSIX.Pathname) return Boolean is begin return Is_Supported (Pathname, PC_ASYNC_IO); end Asynchronous_IO_Is_Supported; function Asynchronous_IO_Is_Supported (File : POSIX.IO.File_Descriptor) return Boolean is begin return Is_Supported (File, PC_ASYNC_IO); end Asynchronous_IO_Is_Supported; ---------------------- -- Prioritized IO -- ---------------------- function Prioritized_IO_Is_Supported (Pathname : POSIX.Pathname) return Boolean is begin return Is_Supported (Pathname, PC_PRIO_IO); end Prioritized_IO_Is_Supported; function Prioritized_IO_Is_Supported (File : POSIX.IO.File_Descriptor) return Boolean is begin return Is_Supported (File, PC_PRIO_IO); end Prioritized_IO_Is_Supported; -- POSIX.5c [D2] additions function Socket_Buffer_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean is begin return Is_Limited (File, PC_SOCK_MAXBUF); end Socket_Buffer_Is_Limited; function Socket_Buffer_Is_Limited (Pathname : POSIX.Pathname) return Boolean is begin return Is_Limited (Pathname, PC_SOCK_MAXBUF); end Socket_Buffer_Is_Limited; function Socket_Buffer_Limit (Pathname : POSIX.Pathname) return POSIX.Limits.Socket_Buffer_Maxima is begin return POSIX.Limits.Socket_Buffer_Maxima (Limit (Pathname, PC_SOCK_MAXBUF, long (POSIX.Limits.Socket_Buffer_Maxima'Last))); end Socket_Buffer_Limit; function Socket_Buffer_Limit (File : POSIX.IO.File_Descriptor) return POSIX.Limits.Socket_Buffer_Maxima is begin return POSIX.Limits.Socket_Buffer_Maxima (Limit (File, PC_SOCK_MAXBUF, long (POSIX.Limits.Socket_Buffer_Maxima'Last))); end Socket_Buffer_Limit; end POSIX.Configurable_File_Limits; florist-gpl-2017-src/libsrc/posix_memory_locking.ads0000644000076700001450000000564013106553472022231 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ M E M O R Y _ L O C K I N G -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Memory_Locking; pragma Elaborate_All (POSIX.Memory_Locking); package POSIX_Memory_Locking renames POSIX.Memory_Locking; florist-gpl-2017-src/libsrc/posix-implementation.gpb0000644000076700001450000003432413106553472022160 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . I M P L E M E N T A T I O N -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with Ada.Exceptions, # if HAVE_Safe_Errno then # else POSIX.Error_Codes, # end if; System.Interrupt_Management.Operations, GNAT.Task_Lock, System.Soft_Links; package body POSIX.Implementation is use POSIX.C; package SIM renames System.Interrupt_Management; package SIMO renames System.Interrupt_Management.Operations; # if HAVE_Safe_Errno then procedure Set_Ada_Error_Code (Error : Error_Code) is begin Store_Errno (Error); end Set_Ada_Error_Code; function Get_Ada_Error_Code return Error_Code is begin return Fetch_Errno; end Get_Ada_Error_Code; # else procedure Set_Ada_Error_Code (Error : Error_Code) is begin POSIX.Error_Codes.Set_Value (Error); end Set_Ada_Error_Code; function Get_Ada_Error_Code return Error_Code is begin return POSIX.Error_Codes.Value; end Get_Ada_Error_Code; # end if; -- .... It would be nice if we had a way to check whether we -- are in a critical section, at the points (below) where we are -- about to raise an exception. These routines should never be -- called from inside a critical section, but that is an easy -- mistake to make. ------------------------------ -- Begin_Critical_Section -- ------------------------------ procedure Begin_Critical_Section is begin GNAT.Task_Lock.Lock; end Begin_Critical_Section; ---------------------------- -- End_Critical_Section -- ---------------------------- procedure End_Critical_Section is begin GNAT.Task_Lock.Unlock; end End_Critical_Section; ---------------------- -- Defer_Abortion -- ---------------------- procedure Defer_Abortion is begin System.Soft_Links.Abort_Defer.all; end Defer_Abortion; ------------------------ -- Undefer_Abortion -- ------------------------ procedure Undefer_Abortion is begin System.Soft_Links.Abort_Undefer.all; end Undefer_Abortion; ------------------------- -- Raise_POSIX_Error -- ------------------------- procedure Raise_POSIX_Error (Error : Error_Code := No_Error) is Tmp : Error_Code := Error; begin -- .... see note on critical sections above if Error = No_Error then Tmp := Fetch_Errno; end if; Set_Ada_Error_Code (Tmp); Ada.Exceptions.Raise_Exception (POSIX_Error'Identity, Image (Tmp)); end Raise_POSIX_Error; ------------- -- Check -- ------------- procedure Check (Condition : Boolean; Error : Error_Code; Old_Mask : Signal_Mask_Access := null) is begin -- .... see note on critical sections above if not Condition then if Old_Mask /= null then Restore_Signals (Old_Mask); end if; Raise_POSIX_Error (Error); end if; end Check; procedure Check (Result : int; Old_Mask : Signal_Mask_Access := null) is begin -- .... see note on critical sections above if Result = -1 then if Old_Mask /= null then Restore_Signals (Old_Mask); end if; Raise_POSIX_Error (Fetch_Errno); end if; end Check; function Check (Result : int; Old_Mask : Signal_Mask_Access := null) return int is begin -- .... see note on critical sections above if Result = -1 then if Old_Mask /= null then Restore_Signals (Old_Mask); end if; Raise_POSIX_Error (Fetch_Errno); end if; return Result; end Check; -- ....is there a better work-around???? -- Provenzano's threads seem to -- return nonstandard negative values for some calls, -- like "close". procedure Check_NNeg (Result : int) is begin -- .... see note on critical sections above if Result < 0 then Raise_POSIX_Error (Fetch_Errno); end if; end Check_NNeg; -- ....is there a better work-around???? -- Provenzano's threads seem to -- return nonstandard negative values for some calls, -- like "close". function Check_NNeg (Result : int) return int is begin -- .... see note on critical sections above. if Result < 0 then Raise_POSIX_Error (Fetch_Errno); end if; return Result; end Check_NNeg; procedure Check_NZ (Result : int) is begin -- .... see note on critical sections above. if Result /= 0 then Raise_POSIX_Error (Error_Code (Result)); end if; end Check_NZ; ------------------- -- Form_String -- ------------------- function strlen (str : char_ptr) return size_t; pragma Import (C, strlen, "strlen"); function Form_String (Str : char_ptr) return String is begin if Str = null then return ""; end if; declare subtype Substring is String (1 .. Integer (strlen (Str))); type Substring_Ptr is access Substring; pragma Warnings (Off); function char_ptr_to_pssptr is new Unchecked_Conversion (char_ptr, Substring_Ptr); pragma Warnings (On); begin return char_ptr_to_pssptr (Str).all; end; end Form_String; --------------------------- -- Trim_Leading_Blanks -- --------------------------- function Trim_Leading_Blank (S : String) return String is begin if S (S'First) /= ' ' then return S; end if; return S (S'First + 1 .. S'Last); end Trim_Leading_Blank; -------------------- -- Nulterminate -- -------------------- type Big_POSIX_String_Ptr is access all POSIX_String (Positive'Range); function From_Address is new Unchecked_Conversion (System.Address, Big_POSIX_String_Ptr); procedure Nulterminate (To : out POSIX_String; From : String) is L : constant Positive := From'Length; begin if To'Length <= L then raise Constraint_Error; end if; To (1 .. L) := From_Address (From'Address) (1 .. L); To (L + 1) := NUL; end Nulterminate; ----------------------- -- Not_Implemented -- ----------------------- function Not_Implemented_Neg_One return int is begin Store_Errno (ENOSYS); return -1; end Not_Implemented_Neg_One; function Not_Implemented_Direct return int is begin return ENOSYS; end Not_Implemented_Direct; function Not_Supported_Neg_One return int is begin Store_Errno (ENOTSUP); return -1; end Not_Supported_Neg_One; function Not_Supported_Direct return int is begin return ENOTSUP; end Not_Supported_Direct; ---------------------- -- Signal Masking -- ---------------------- -- For RTS_Signals we mask all the signals identified as reserved -- by the tasking RTS. However, we leave SIGABRT alone since it is being -- used as the signal for abortion which needs to be invoked for -- POSIX.Signals.Interrupt_Task. Do not mask SIGTRAP either because -- this signal is used by the debugger. -- ...Fix POSIX.5b???? -- It seems we are deviating here from what the standard says, but for -- very good reasons. procedure Mask_Signals (Masking : Signal_Masking; Old_Mask : Signal_Mask_Access) is use type SIM.Interrupt_ID; begin if Masking /= No_Signals then declare New_Mask : aliased Signal_Mask; begin Begin_Critical_Section; SIMO.Get_Interrupt_Mask (New_Mask'Unchecked_Access); SIMO.Copy_Interrupt_Mask (Old_Mask.all, New_Mask); if Masking = RTS_Signals then for J in 1 .. SIM.Interrupt_ID'Last loop if SIM.Reserve (J) and J /= SIGABRT and J /= SIGTRAP then SIMO.Add_To_Interrupt_Mask (New_Mask'Unchecked_Access, J); end if; end loop; else -- All_Signals SIMO.Fill_Interrupt_Mask (New_Mask'Unchecked_Access); end if; SIMO.Set_Interrupt_Mask (New_Mask'Unchecked_Access); End_Critical_Section; end; end if; end Mask_Signals; procedure Restore_Signals (Masking : Signal_Masking; Old_Mask : Signal_Mask_Access) is begin if Masking /= No_Signals then Begin_Critical_Section; SIMO.Set_Interrupt_Mask (Old_Mask); End_Critical_Section; end if; end Restore_Signals; procedure Restore_Signals (Old_Mask : Signal_Mask_Access) is begin Begin_Critical_Section; SIMO.Set_Interrupt_Mask (Old_Mask); End_Critical_Section; end Restore_Signals; ------------------------------------- -- Check_..._And_Restore_Signals -- ------------------------------------- procedure Restore_Signals_And_Raise_POSIX_Error (Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access) is Error : constant Error_Code := Fetch_Errno; begin Restore_Signals (Masked_Signals, Old_Mask); Raise_POSIX_Error (Error); end Restore_Signals_And_Raise_POSIX_Error; procedure Check_NNeg_And_Restore_Signals (Result : int; Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access) is begin if Result < 0 then Restore_Signals_And_Raise_POSIX_Error (Masked_Signals, Old_Mask); else Restore_Signals (Masked_Signals, Old_Mask); end if; end Check_NNeg_And_Restore_Signals; -------------------------- -- To_Struct_Timespec -- -------------------------- function To_Struct_Timespec (D : Duration) return struct_timespec is S : time_t; F : Duration; begin S := time_t (Long_Long_Integer (D)); F := D - Duration (S); -- If F has negative value due to a round-up, adjust for positive F -- value. if F < 0.0 then S := S - 1; F := F + 1.0; end if; return struct_timespec'(tv_sec => S, tv_nsec => long (Long_Long_Integer (F * NS_per_S))); end To_Struct_Timespec; function To_Struct_Timespec (T : Timespec) return struct_timespec is begin return To_Struct_Timespec (To_Duration (T)); end To_Struct_Timespec; ------------------- -- To_Duration -- ------------------- function To_Duration (TS : struct_timespec) return Duration is begin return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / NS_per_S; end To_Duration; ------------------- -- To_Timespec -- ------------------- function To_Timespec (TS : struct_timespec) return Timespec is begin return Timespec' (Val => Duration (TS.tv_sec) + Duration (TS.tv_nsec) / NS_per_S); end To_Timespec; ------------------- -- To_Duration -- ------------------- function To_Duration (TV : struct_timeval) return Duration is begin return Duration (TV.tv_sec) + Duration (TV.tv_usec) / MS_per_S; end To_Duration; ------------------------- -- To_Struct_Timeval -- ------------------------- function To_Struct_Timeval (D : Duration) return struct_timeval is S : time_t; F : Duration; begin S := time_t (Long_Long_Integer (D)); F := D - Duration (S); -- If F has negative value due to a round-up, adjust for positive F -- value. if F < 0.0 then S := S - 1; F := F + 1.0; end if; return struct_timeval'(tv_sec => S, tv_usec => suseconds_t (Long_Long_Integer (F * MS_per_S))); end To_Struct_Timeval; end POSIX.Implementation; florist-gpl-2017-src/libsrc/threads/0000755000076700001450000000000013106553470016723 5ustar gnatmailgnatflorist-gpl-2017-src/libsrc/threads/posix-mutexes.ads0000644000076700001450000001354513106553472022260 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . M U T E X E S -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX.C; package POSIX.Mutexes is -- ========== -- -- WARNINGS -- -- ========== -- -- This package is for mixed-language programming, in which -- an Ada task needs to synchronize with a C thread. -- Do NOT use POSIX mutexes to synchronize between Ada tasks. -- Instead, use Ada protected objects. -- Protected objects are implemented using mutexes. -- The difference is that they are safer. -- In particular protected operations are abort-deferred, -- and have cleanup code to ensure mutexes are always released, -- even if a protected operation completes abnormally due to an exception. -- If you use one of these "raw" mutexes, you risk undefined -- behavior if you violate any of the POSIX.1c rules about mutexes, -- or if you attempt to abort (including ATC) a task that is performing -- a mutex or CV operation. type Mutex is limited private; type Mutex_Descriptor is private; type Attributes is private; procedure Initialize (Attr : in out Attributes); procedure Finalize (Attr : in out Attributes); function Get_Process_Shared (Attr : Attributes) return Boolean; procedure Set_Process_Shared (Attr : in out Attributes; Is_Shared : Boolean := False); subtype Ceiling_Priority is Integer; type Locking_Policy is range 0 .. 2; No_Priority_Inheritance : constant Locking_Policy := 0; Highest_Blocked_Task : constant Locking_Policy := 1; Highest_Ceiling_Priority : constant Locking_Policy := 2; procedure Set_Locking_Policy (Attr : in out Attributes; Locking : Locking_Policy); function Get_Locking_Policy (Attr : Attributes) return Locking_Policy; procedure Set_Ceiling_Priority (Attr : in out Attributes; New_Ceiling : Ceiling_Priority); function Get_Ceiling_Priority (Attr : Attributes) return Ceiling_Priority; procedure Initialize (M : in out Mutex; Attr : Attributes); procedure Initialize (M : in out Mutex); function Descriptor_Of (M : Mutex) return Mutex_Descriptor; procedure Finalize (M : in out Mutex); procedure Set_Ceiling_Priority (M : Mutex_Descriptor; New_Ceiling : Ceiling_Priority; Old_Ceiling : out Ceiling_Priority); function Get_Ceiling_Priority (M : Mutex_Descriptor) return Ceiling_Priority; procedure Lock (M : Mutex_Descriptor); function Try_Lock (M : Mutex_Descriptor) return Boolean; procedure Unlock (M : Mutex_Descriptor); private type Dummy is tagged null record; type Attributes is record Attr : aliased POSIX.C.pthread_mutexattr_t; -- to force by-reference parameter mode: D : Dummy; end record; type Mutex is record Mutex : aliased POSIX.C.pthread_mutex_t; -- to force by-reference parameter mode: D : Dummy; end record; -- The "access constant" is sometimes a lie, but it allows -- us to emulate the POSIX C-language interface without violating -- Ada rules about pointers to variables vs. pointers to constants. type Mutex_Descriptor is access constant POSIX.C.pthread_mutex_t; pragma Convention (C, Mutex_Descriptor); end POSIX.Mutexes; florist-gpl-2017-src/libsrc/threads/posix-message_queues.ads0000644000076700001450000002000713106553472023570 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . M E S S A G E _ Q U E U E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2010, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.IO, POSIX.Configurable_System_Limits, POSIX.Permissions, POSIX.Signals; pragma Elaborate_All (POSIX.Configurable_System_Limits); package POSIX.Message_Queues is type Message_Queue_Descriptor is private; type Attributes is private; type Message_Queue_Options is new POSIX.Option_Set; Non_Blocking : constant Message_Queue_Options := Message_Queue_Options (POSIX.IO.Non_Blocking); subtype Message_Priority is Integer range 0 .. POSIX.Configurable_System_Limits.Message_Priority_Maximum; -- ????? -- POSIX.5b may need revision here. By definining the range -- of Message_Priority sufficiently precisely, we end up raising -- Constraint_Error in all situations where the priority is out -- of the supported range, but the standard says we should raise -- POSIX_Error with Invalid_Argument in these situations. In -- particular, see the procedure Send. Technically, it is not -- necessary to list Constraint_Error as a possibility in the -- Error Handling section of the standard, since it follows from -- the Ada language definition that Constraint_Error is raised -- under such circumstances, but it might be better if there were -- an explicit note pointing this out. procedure Set_Max_Messages (Attrs : in out Attributes; Value : Natural); function Get_Max_Messages (Attrs : Attributes) return Natural; procedure Set_Message_Length (Attrs : in out Attributes; Value : Natural); function Get_Message_Length (Attrs : Attributes) return Natural; procedure Set_Options (Attrs : in out Attributes; Value : Message_Queue_Options); function Get_Options (Attrs : Attributes) return Message_Queue_Options; function Get_Message_Count (Attrs : Attributes) return Natural; function Open (Name : POSIX.POSIX_String; Mode : POSIX.IO.File_Mode; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return Message_Queue_Descriptor; function Open_Or_Create (Name : POSIX.POSIX_String; Mode : POSIX.IO.File_Mode; Permissions : POSIX.Permissions.Permission_Set; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return Message_Queue_Descriptor; function Open_Or_Create (Name : POSIX.POSIX_String; Mode : POSIX.IO.File_Mode; Permissions : POSIX.Permissions.Permission_Set; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Attrs : Attributes; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return Message_Queue_Descriptor; procedure Close (MQ : in out Message_Queue_Descriptor); procedure Unlink_Message_Queue (Name : POSIX.POSIX_String); procedure Send (MQ : Message_Queue_Descriptor; Message : Ada.Streams.Stream_Element_Array; Priority : Message_Priority; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Receive (MQ : Message_Queue_Descriptor; Message : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Priority : out Message_Priority; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); generic type Message_Type is private; package Generic_Message_Queues is procedure Send (MQ : Message_Queue_Descriptor; Message : Message_Type; Priority : Message_Priority; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Receive (MQ : Message_Queue_Descriptor; Message : out Message_Type; Priority : out Message_Priority; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); function Get_Error_Buffer return Ada.Streams.Stream_Element_Array; end Generic_Message_Queues; procedure Request_Notify (MQ : Message_Queue_Descriptor; Event : POSIX.Signals.Signal_Event); procedure Remove_Notify (MQ : Message_Queue_Descriptor); procedure Set_Attributes (MQ : Message_Queue_Descriptor; New_Attrs : Attributes; Old_Attrs : out Attributes); procedure Set_Attributes (MQ : Message_Queue_Descriptor; New_Attrs : Attributes); function Get_Attributes (MQ : Message_Queue_Descriptor) return Attributes; private type Message_Queue_Descriptor is new POSIX.C.mqd_t; type Attributes is record Attrs : aliased POSIX.C.struct_mq_attr := (0, 0, 0, 0); end record; end POSIX.Message_Queues; -- .... Change POSIX.5b????? -- These interfaces would be easier to use if it were possible to specify -- a message buffer via its address, rather than an unconstrained array -- parameter. The present interface forces people to copy data into the -- buffer, and possibly also out from the buffer. It would be more -- convenient and efficient to pass references to data to these calls and -- leave the data itself in-place. florist-gpl-2017-src/libsrc/threads/posix_mutexes.ads0000644000076700001450000000560413106553472022337 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ M U T E X E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Mutexes; pragma Elaborate_All (POSIX.Mutexes); package POSIX_Mutexes renames POSIX.Mutexes; florist-gpl-2017-src/libsrc/threads/ada_task_identification.ads0000644000076700001450000000615113106553472024241 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- A D A _ T A S K _ I D E N T I F I C A T I O N -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996, 1997 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- Copyright (C) 2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with Ada.Task_Identification; package Ada_Task_Identification renames Ada.Task_Identification; florist-gpl-2017-src/libsrc/threads/posix_asynchronous_io.ads0000644000076700001450000000576313106553472024075 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ A S Y N C H R O N O U S _ I O -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 1991-1994 Florida State University -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Asynchronous_IO; pragma Elaborate_All (POSIX.Asynchronous_IO); package POSIX_Asynchronous_IO renames POSIX.Asynchronous_IO; florist-gpl-2017-src/libsrc/threads/posix_process_primitives.ads0000644000076700001450000000566013106553472024600 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ P R O C E S S _ P R I M I T I V E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Process_Primitives; pragma Elaborate_All (POSIX.Process_Primitives); package POSIX_Process_Primitives renames POSIX.Process_Primitives; florist-gpl-2017-src/libsrc/threads/posix-signals.ads0000644000076700001450000003203513106553472022221 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . S I G N A L S -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with Ada.Task_Identification, Ada.Finalization, POSIX, POSIX.C, POSIX.Process_Identification, System, System.Interrupt_Management, System.Storage_Elements; -- To ensure that this file does not get compiled when thread support is -- disabled pragma Warnings (Off); with POSIX.Implementation.OK_Signals; pragma Warnings (On); package POSIX.Signals is -- Signal Type type Signal is new System.Interrupt_Management.Interrupt_ID'Base range 0 .. POSIX.C.NSIGS; for Signal'Size use POSIX.C.int'Size; function Image (Sig : Signal) return String; function Value (Str : String) return Signal; -- Standard Signals (required) Signal_Null, SIGNULL : constant Signal := 0; Signal_Abort, SIGABRT : constant Signal := POSIX.C.SIGABRT; Signal_Alarm, SIGALRM : constant Signal := POSIX.C.SIGALRM; Signal_Bus_Error, SIGBUS : constant Signal := POSIX.C.SIGBUS; Signal_Floating_Point_Error, SIGFPE : constant Signal := POSIX.C.SIGFPE; Signal_Hangup, SIGHUP : constant Signal := POSIX.C.SIGHUP; Signal_Illegal_Instruction, SIGILL : constant Signal := POSIX.C.SIGILL; Signal_Interrupt, SIGINT : constant Signal := POSIX.C.SIGINT; Signal_Kill, SIGKILL : constant Signal := POSIX.C.SIGKILL; Signal_Pipe_Write, SIGPIPE : constant Signal := POSIX.C.SIGPIPE; Signal_Quit, SIGQUIT : constant Signal := POSIX.C.SIGQUIT; Signal_Segmentation_Violation, SIGSEGV : constant Signal := POSIX.C.SIGSEGV; Signal_Terminate, SIGTERM : constant Signal := POSIX.C.SIGTERM; Signal_User_1, SIGUSR1 : constant Signal := POSIX.C.SIGUSR1; Signal_User_2, SIGUSR2 : constant Signal := POSIX.C.SIGUSR2; -- Standard Signals (job control) Signal_Child, SIGCHLD : constant Signal := POSIX.C.SIGCHLD; Signal_Continue, SIGCONT : constant Signal := POSIX.C.SIGCONT; Signal_Stop, SIGSTOP : constant Signal := POSIX.C.SIGSTOP; Signal_Terminal_Stop, SIGTSTP : constant Signal := POSIX.C.SIGTSTP; Signal_Terminal_Input, SIGTTIN : constant Signal := POSIX.C.SIGTTIN; Signal_Terminal_Output, SIGTTOU : constant Signal := POSIX.C.SIGTTOU; -- Signals from P1003.5c Signal_IO, SIGIO : constant Signal := POSIX.C.SIGIO; Signal_Out_Of_Band_Data, SIGURG : constant Signal := POSIX.C.SIGURG; subtype Realtime_Signal is Signal range POSIX.C.SIGRTMIN .. POSIX.C.SIGRTMAX; -- Signal sets type Signal_Set is private; procedure Add_Signal (Set : in out Signal_Set; Sig : Signal); procedure Add_All_Signals (Set : in out Signal_Set); procedure Delete_Signal (Set : in out Signal_Set; Sig : Signal); procedure Delete_All_Signals (Set : in out Signal_Set); function Is_Member (Set : Signal_Set; Sig : Signal) return Boolean; -- Blocking and Unblocking Signals procedure Set_Blocked_Signals (New_Mask : Signal_Set; Old_Mask : out Signal_Set); procedure Block_Signals (Mask_to_Add : Signal_Set; Old_Mask : out Signal_Set); procedure Unblock_Signals (Mask_to_Subtract : Signal_Set; Old_Mask : out Signal_Set); function Blocked_Signals return Signal_Set; -- Ignoring Signals procedure Ignore_Signal (Sig : Signal); procedure Unignore_Signal (Sig : Signal); function Is_Ignored (Sig : Signal) return Boolean; procedure Install_Empty_Handler (Sig : Signal); -- Controlling Delivery of Signal_Child Signal procedure Set_Stopped_Child_Signal (Enable : Boolean := True); function Stopped_Child_Signal_Enabled return Boolean; -- Examining Pending Signals function Pending_Signals return Signal_Set; type Signal_Event is private; type Signal_Data is private; type Notification is range Integer'First .. Integer'Last; No_Notification : constant Notification := POSIX.C.SIGEV_NONE; Signal_Notification : constant Notification := POSIX.C.SIGEV_SIGNAL; function Get_Signal (Event : Signal_Event) return Signal; procedure Set_Signal (Event : in out Signal_Event; Sig : Signal); function Get_Notification (Event : Signal_Event) return Notification; procedure Set_Notification (Event : in out Signal_Event; Notify : Notification); function Get_Data (Event : Signal_Event) return Signal_Data; procedure Set_Data (Event : in out Signal_Event; Data : Signal_Data); type Signal_Source is range Integer'First .. Integer'Last; From_Send_Signal : constant Signal_Source := POSIX.C.SI_USER; From_Queue_Signal : constant Signal_Source := POSIX.C.SI_QUEUE; From_Timer : constant Signal_Source := POSIX.C.SI_TIMER; From_Async_IO : constant Signal_Source := POSIX.C.SI_ASYNCIO; From_Message_Queue : constant Signal_Source := POSIX.C.SI_MESGQ; type Signal_Info is private; function Get_Signal (Info : Signal_Info) return Signal; procedure Set_Signal (Info : in out Signal_Info; Sig : Signal); function Get_Source (Info : Signal_Info) return Signal_Source; procedure Set_Source (Info : in out Signal_Info; Source : Signal_Source); function Has_Data (Source : Signal_Source) return Boolean; function Get_Data (Info : Signal_Info) return Signal_Data; procedure Set_Data (Info : in out Signal_Info; Data : Signal_Data); procedure Enable_Queueing (Sig : Signal); procedure Disable_Queueing (Sig : Signal); function Await_Signal (Set : Signal_Set) return Signal; function Await_Signal_Or_Timeout (Set : Signal_Set; Timeout : POSIX.Timespec) return Signal; function Await_Signal (Set : Signal_Set) return Signal_Info; function Await_Signal_Or_Timeout (Set : Signal_Set; Timeout : POSIX.Timespec) return Signal_Info; Signal_Abort_Ref : constant System.Address := System.Storage_Elements.To_Address (System.Storage_Elements.Integer_Address (SIGABRT)); Signal_Hangup_Ref : constant System.Address := System.Storage_Elements.To_Address (System.Storage_Elements.Integer_Address (SIGHUP)); Signal_Interrupt_Ref : constant System.Address := System.Storage_Elements.To_Address (System.Storage_Elements.Integer_Address (SIGINT)); Signal_Pipe_Write_Ref : constant System.Address := System.Storage_Elements.To_Address (System.Storage_Elements.Integer_Address (SIGPIPE)); Signal_Quit_Ref : constant System.Address := System.Storage_Elements.To_Address (System.Storage_Elements.Integer_Address (SIGQUIT)); Signal_Terminate_Ref : constant System.Address := System.Storage_Elements.To_Address (System.Storage_Elements.Integer_Address (SIGTERM)); Signal_User_1_Ref : constant System.Address := System.Storage_Elements.To_Address (System.Storage_Elements.Integer_Address (SIGUSR1)); Signal_User_2_Ref : constant System.Address := System.Storage_Elements.To_Address (System.Storage_Elements.Integer_Address (SIGUSR2)); Signal_Child_Ref : constant System.Address := System.Storage_Elements.To_Address (System.Storage_Elements.Integer_Address (SIGCHLD)); Signal_Continue_Ref : constant System.Address := System.Storage_Elements.To_Address (System.Storage_Elements.Integer_Address (SIGCONT)); Signal_Terminal_Stop_Ref : constant System.Address := System.Storage_Elements.To_Address (System.Storage_Elements.Integer_Address (SIGTSTP)); Signal_Terminal_Input_Ref : constant System.Address := System.Storage_Elements.To_Address (System.Storage_Elements.Integer_Address (SIGTTIN)); Signal_Terminal_Output_Ref : constant System.Address := System.Storage_Elements.To_Address (System.Storage_Elements.Integer_Address (SIGTTOU)); function Signal_Reference (Sig : Signal) return System.Address; procedure Send_Signal (Process : POSIX.Process_Identification.Process_ID; Sig : Signal); procedure Send_Signal (Group : POSIX.Process_Identification.Process_Group_ID; Sig : Signal); procedure Send_Signal (Sig : Signal); procedure Queue_Signal (Process : POSIX.Process_Identification.Process_ID; Sig : Signal; Data : Signal_Data); procedure Interrupt_Task (T : Ada.Task_Identification.Task_Id); private type Signal_Set is new Ada.Finalization.Controlled with record C : aliased POSIX.C.sigset_t; end record; procedure Initialize (Set : in out Signal_Set); procedure Finalize (Set : in out Signal_Set); -- We formerly used an explicit array, rather than the C type -- sigset_t, because: -- 1. C provides no operation to enumerate the -- members of a sigset_t, other than calling sigismember() for -- every value in the range of valid Signals. -- 2. We would have to use a controlled type to do the initialization, -- since making a sigset_t object empty requires calling sigemptyset. -- We should have put the array inside a record, to get -- default initialization, but did not -- a mistake that needed -- correcting in any case. -- 3. We thought objects of type sigset_t might involve implicitly -- allocated dynamic storage, which could lead to storage leakage, -- and would not support private-type (assignment) semantics. -- Unfortunately, using this different representation meant quite a -- bit of extra computation, to translate between the two forms, and -- that ends up with iteration over the range of valid Signals anyway. -- The current solution does assume that the sigset_t representation -- supports meaningful equality testing. type Signal_Info is new POSIX.C.siginfo_t; type Signal_Event is new POSIX.C.struct_sigevent; type Signal_Data is record Data : System.Storage_Elements.Storage_Array (1 .. POSIX.C.sigval_byte_size); end record; for Signal_Data'Alignment use POSIX.C.sigval_alignment; end POSIX.Signals; florist-gpl-2017-src/libsrc/threads/posix_timers.ads0000644000076700001450000000560013106553472022144 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ T I M E R S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Timers; pragma Elaborate_All (POSIX.Timers); package POSIX_Timers renames POSIX.Timers; florist-gpl-2017-src/libsrc/threads/posix-timers-extensions.gpb0000644000076700001450000000544413106553472024266 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . T I M E R S . E X T E N S I O N S -- -- -- -- B o d y -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ package body POSIX.Timers.Extensions is -------------------- -- Clock_SGI_Fast -- -------------------- function Clock_SGI_Fast return Clock_ID is begin # if HAVE_IRIX_Timers then return POSIX.C.CLOCK_SGI_FAST; # else return -1; # end if; end Clock_SGI_Fast; end POSIX.Timers.Extensions; florist-gpl-2017-src/libsrc/threads/posix-timers.adb0000644000076700001450000002347713106553472022055 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . T I M E R S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation, Unchecked_Conversion; package body POSIX.Timers is use POSIX.C; use POSIX.Implementation; function To_int is new Unchecked_Conversion (Bits, int); function To_Struct_Sigevent is new Unchecked_Conversion (POSIX.Signals.Signal_Event, POSIX.C.struct_sigevent); Zero_Timespec : aliased constant struct_timespec := (0, 0); Zero_State : aliased constant struct_itimerspec := ((0, 0), (0, 0)); ------------------- -- Set_Initial -- ------------------- procedure Set_Initial (State : in out Timer_State; Initial : POSIX.Timespec) is begin State.State.it_value := To_Struct_Timespec (Initial); end Set_Initial; ------------------- -- Get_Initial -- ------------------- function Get_Initial (State : Timer_State) return POSIX.Timespec is begin return To_Timespec (To_Duration (State.State.it_value)); end Get_Initial; -------------------- -- Set_Interval -- -------------------- procedure Set_Interval (State : in out Timer_State; Interval : POSIX.Timespec) is begin State.State.it_interval := To_Struct_Timespec (Interval); end Set_Interval; -------------------- -- Get_Interval -- -------------------- function Get_Interval (State : Timer_State) return POSIX.Timespec is begin return To_Timespec (To_Duration (State.State.it_interval)); end Get_Interval; ----------------- -- Set_Time -- ----------------- function clock_settime (clock_id : clockid_t; tp : timespec_ptr) return int; pragma Import (C, clock_settime, clock_settime_LINKNAME); procedure Set_Time (Clock : Clock_ID; Value : POSIX.Timespec) is TS : aliased struct_timespec; begin TS := To_Struct_Timespec (Value); Check (clock_settime (clockid_t (Clock), TS'Unchecked_Access)); end Set_Time; ---------------- -- Set_Time -- ---------------- procedure Set_Time (Value : POSIX.Timespec) is TS : aliased struct_timespec; begin TS := To_Struct_Timespec (Value); Check (clock_settime (POSIX.C.CLOCK_REALTIME, TS'Unchecked_Access)); end Set_Time; ---------------- -- Get_Time -- ---------------- function clock_gettime (clock_id : clockid_t; tp : access struct_timespec) return int; pragma Import (C, clock_gettime, clock_gettime_LINKNAME); function Get_Time (Clock : Clock_ID := Clock_Realtime) return POSIX.Timespec is TS : aliased struct_timespec; begin Check (clock_gettime (clockid_t (Clock), TS'Unchecked_Access)); return To_Timespec (To_Duration (TS)); end Get_Time; ---------------------- -- Get_Resolution -- ---------------------- function Get_Resolution (Clock : Clock_ID := Clock_Realtime) return POSIX.Timespec is function clock_getres (clock_id : clockid_t; res : access struct_timespec) return int; pragma Import (C, clock_getres, clock_getres_LINKNAME); TS : aliased struct_timespec; begin Check (clock_getres (clockid_t (Clock), TS'Unchecked_Access)); return To_Timespec (To_Duration (TS)); end Get_Resolution; -------------------- -- Create_Timer -- -------------------- function Create_Timer (Clock : Clock_ID; Event : POSIX.Signals.Signal_Event) return Timer_ID is function timer_create (clock_id : clockid_t; evp : sigevent_ptr; timerid : access timer_t) return int; pragma Import (C, timer_create, timer_create_LINKNAME); -- .... Consider making Signal_Event into a tagged type -- so that we don't need to make a local copy. E : aliased POSIX.C.struct_sigevent := To_Struct_Sigevent (Event); TID : aliased timer_t; begin if E.sigev_notify = POSIX.C.SIGEV_NONE then -- make sure the other fields are valid E.sigev_signo := SIGUSR1; E.sigev_value := null_sigval; end if; Check (timer_create (clockid_t (Clock), E'Unchecked_Access, TID'Unchecked_Access)); return Timer_ID (TID); end Create_Timer; -------------------- -- Delete_Timer -- -------------------- procedure Delete_Timer (Timer : in out Timer_ID) is function timer_delete (timer_id : timer_t) return int; pragma Import (C, timer_delete, timer_delete_LINKNAME); begin Check (timer_delete (timer_t (Timer))); end Delete_Timer; ----------------- -- Arm_Timer -- ----------------- function timer_settime (timer_id : timer_t; flags : C.int; value : itimerspec_ptr; ovalue : itimerspec_ptr) return int; pragma Import (C, timer_settime, timer_settime_LINKNAME); procedure Arm_Timer (Timer : Timer_ID; Options : Timer_Options; New_State : Timer_State; Old_State : out Timer_State) is begin -- ????? Change POSIX.5b? -- The following two checks are required by .5b, but -- they are inconsistent with one another -- and they do not seem to be founded on the .1b specification. if Options = Absolute_Timer then Check (New_State.State.it_value /= Zero_Timespec, Invalid_Argument); else Check (New_State.State.it_value.tv_sec > 0, Invalid_Argument); end if; Check (timer_settime (timer_t (Timer), To_int (Option_Set (Options).Option), New_State.State'Unchecked_Access, Old_State.State'Unchecked_Access)); end Arm_Timer; ----------------- -- Arm_Timer -- ----------------- procedure Arm_Timer (Timer : Timer_ID; Options : Timer_Options; New_State : Timer_State) is begin Check (New_State.State.it_value /= Zero_Timespec, Invalid_Argument); Check (timer_settime (timer_t (Timer), To_int (Option_Set (Options).Option), New_State.State'Unchecked_Access, null)); end Arm_Timer; ----------------------- -- Get_Timer_State -- ----------------------- function Get_Timer_State (Timer : Timer_ID) return Timer_State is function timer_gettime (timer_id : timer_t; value : access struct_itimerspec) return int; pragma Import (C, timer_gettime, timer_gettime_LINKNAME); TS : Timer_State; begin Check (timer_gettime (timer_t (Timer), TS.State'Unchecked_Access)); return TS; end Get_Timer_State; -------------------- -- Disarm_Timer -- -------------------- procedure Disarm_Timer (Timer : Timer_ID) is begin Check (timer_settime (timer_t (Timer), 0, Zero_State'Unchecked_Access, null)); end Disarm_Timer; -------------------------- -- Get_Timer_Overruns -- -------------------------- function Get_Timer_Overruns (Timer : Timer_ID) return Natural is function timer_getoverrun (timer_id : timer_t) return int; pragma Import (C, timer_getoverrun, timer_getoverrun_LINKNAME); begin return Natural (Check (timer_getoverrun (timer_t (Timer)))); end Get_Timer_Overruns; end POSIX.Timers; florist-gpl-2017-src/libsrc/threads/posix-process_primitives.ads0000644000076700001450000002017213106553472024511 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P R O C E S S _ P R I M I T I V E S -- -- -- -- S p e c -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX, POSIX.C, POSIX.IO, POSIX.Process_Environment, POSIX.Process_Identification, POSIX.Signals; package POSIX.Process_Primitives is -- Process Template type Process_Template is limited private; procedure Open_Template (Template : in out Process_Template); procedure Close_Template (Template : in out Process_Template); procedure Set_Keep_Effective_IDs (Template : in out Process_Template); procedure Set_Signal_Mask (Template : in out Process_Template; Mask : POSIX.Signals.Signal_Set); procedure Set_Creation_Signal_Masking (Template : in out Process_Template; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Set_File_Action_To_Close (Template : in out Process_Template; File : POSIX.IO.File_Descriptor); procedure Set_File_Action_To_Open (Template : in out Process_Template; File : POSIX.IO.File_Descriptor; Name : POSIX.Pathname; Mode : POSIX.IO.File_Mode := POSIX.IO.Read_Only; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set); procedure Set_File_Action_To_Duplicate (Template : in out Process_Template; File : POSIX.IO.File_Descriptor; From_File : POSIX.IO.File_Descriptor); -- Process Creation procedure Start_Process (Child : out POSIX.Process_Identification.Process_ID; Pathname : POSIX.Pathname; Template : Process_Template; Arg_List : POSIX.POSIX_String_List := POSIX.Empty_String_List); procedure Start_Process (Child : out POSIX.Process_Identification.Process_ID; Pathname : POSIX.Pathname; Template : Process_Template; Env_List : POSIX.Process_Environment.Environment; Arg_List : POSIX.POSIX_String_List := POSIX.Empty_String_List); procedure Start_Process_Search (Child : out POSIX.Process_Identification.Process_ID; Filename : POSIX.Filename; Template : Process_Template; Arg_List : POSIX.POSIX_String_List := POSIX.Empty_String_List); procedure Start_Process_Search (Child : out POSIX.Process_Identification.Process_ID; Filename : POSIX.Filename; Template : Process_Template; Env_List : POSIX.Process_Environment.Environment; Arg_List : POSIX.POSIX_String_List := POSIX.Empty_String_List); -- Process Exit type Exit_Status is range 0 .. 2 ** 8 - 1; Normal_Exit : constant Exit_Status := 0; Failed_Creation_Exit : constant Exit_Status := 41; Unhandled_Exception_Exit : constant Exit_Status := 42; procedure Exit_Process (Status : Exit_Status := Normal_Exit); -- Termination Status type Termination_Status is private; type Termination_Cause is (Exited, Terminated_By_Signal, Stopped_By_Signal); function Status_Available (Status : Termination_Status) return Boolean; function Process_ID_Of (Status : Termination_Status) return POSIX.Process_Identification.Process_ID; function Termination_Cause_Of (Status : Termination_Status) return Termination_Cause; function Exit_Status_Of (Status : Termination_Status) return Exit_Status; function Termination_Signal_Of (Status : Termination_Status) return POSIX.Signals.Signal; function Stopping_Signal_Of (Status : Termination_Status) return POSIX.Signals.Signal; -- Wait for Process Termination procedure Wait_For_Child_Process (Status : out Termination_Status; Child : POSIX.Process_Identification.Process_ID; Block : Boolean := True; Trace_Stopped : Boolean := True; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Wait_For_Child_Process (Status : out Termination_Status; Group : POSIX.Process_Identification.Process_Group_ID; Block : Boolean := True; Trace_Stopped : Boolean := True; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Wait_For_Child_Process (Status : out Termination_Status; Block : Boolean := True; Trace_Stopped : Boolean := True; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); private type Termination_Status is record pid : POSIX.C.pid_t := POSIX.C.pid_t (Integer'(-1)); stat_val : aliased POSIX.C.int := 0; end record; type FD_Action_Type is (Open, Close, Duplicate); type FD_Set_Element (FD_Action : FD_Action_Type; File_Name_Size : Positive); type FD_Set_Ptr is access FD_Set_Element; type FD_Set_Element (FD_Action : FD_Action_Type; File_Name_Size : Positive) is record FD : POSIX.IO.File_Descriptor; Next : FD_Set_Ptr; Action : FD_Action_Type; case FD_Action is when Close => null; when Open => File_Name : POSIX.Pathname (1 .. File_Name_Size); File_Mode : POSIX.IO.File_Mode; File_Options : POSIX.IO.Open_Option_Set; when Duplicate => Dup_From : POSIX.IO.File_Descriptor; end case; end record; type Process_Template is record Is_Closed : Boolean := True; Keep_Effective_IDs : Boolean; Sig_Set : POSIX.Signals.Signal_Set; -- Implicitly initialized to no signal by POSIX_Signals. Masked_Sig : POSIX.Signal_Masking := POSIX.RTS_Signals; FD_Set : FD_Set_Ptr; end record; end POSIX.Process_Primitives; florist-gpl-2017-src/libsrc/threads/posix-message_queues.adb0000644000076700001450000004031113106553472023547 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . M E S S A G E _ Q U E U E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2010, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with Ada.Streams, POSIX.Implementation, POSIX.Permissions.Implementation, System, Unchecked_Conversion; package body POSIX.Message_Queues is use Ada.Streams; use POSIX.C; use POSIX.Implementation; use POSIX.Permissions.Implementation; function To_int is new Unchecked_Conversion (Bits, int); function To_Bits is new Unchecked_Conversion (int, Bits); C_File_Mode : constant array (POSIX.IO.File_Mode) of Bits := (POSIX.IO.Read_Only => O_RDONLY, POSIX.IO.Write_Only => O_WRONLY, POSIX.IO.Read_Write => O_RDWR); function Check_NNeg_And_Restore_Signals (Result : Message_Queue_Descriptor; Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access) return Message_Queue_Descriptor; function Check_NNeg_And_Restore_Signals (Result : Message_Queue_Descriptor; Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access) return Message_Queue_Descriptor is begin if Result < 0 then Restore_Signals_And_Raise_POSIX_Error (Masked_Signals, Old_Mask); return Result; else Restore_Signals (Masked_Signals, Old_Mask); return Result; end if; end Check_NNeg_And_Restore_Signals; ------------------------ -- Set_Max_Messages -- ------------------------ procedure Set_Max_Messages (Attrs : in out Attributes; Value : Natural) is begin Attrs.Attrs.mq_maxmsg := long (Value); end Set_Max_Messages; ------------------------ -- Get_Max_Messages -- ------------------------ function Get_Max_Messages (Attrs : Attributes) return Natural is begin return Natural (Attrs.Attrs.mq_maxmsg); end Get_Max_Messages; -------------------------- -- Set_Message_Length -- -------------------------- procedure Set_Message_Length (Attrs : in out Attributes; Value : Natural) is begin Attrs.Attrs.mq_msgsize := long (Value); end Set_Message_Length; -------------------------- -- Get_Message_Length -- -------------------------- function Get_Message_Length (Attrs : Attributes) return Natural is begin return Natural (Attrs.Attrs.mq_msgsize); end Get_Message_Length; ------------------- -- Set_Options -- ------------------- procedure Set_Options (Attrs : in out Attributes; Value : Message_Queue_Options) is begin Attrs.Attrs.mq_flags := long (To_int (Option_Set (Value).Option)); end Set_Options; ------------------- -- Get_Options -- ------------------- function Get_Options (Attrs : Attributes) return Message_Queue_Options is begin return Message_Queue_Options (Option_Set '(Option => To_Bits (int (Attrs.Attrs.mq_flags)))); -- ???? -- The above conversion of long value to int is risky. -- If the high-order bits are used, we may need to consider -- reimplementing Option_Set as long, or changing the POSIX.5b spec. -- .... Change POSIX.5b? -- It was a mistake to use Option_Set here for a value that the -- C-language interface says is a "long". Option_Set in other places -- is only used to map bit-vectors of type "int". end Get_Options; ------------------------- -- Get_Message_Count -- ------------------------- function Get_Message_Count (Attrs : Attributes) return Natural is begin return Natural (Attrs.Attrs.mq_curmsgs); end Get_Message_Count; ------------ -- Open -- ------------ function mq_open (name : char_ptr; oflag : int; mode : mode_t; attr : mq_attr_ptr) return Message_Queue_Descriptor; pragma Import (C, mq_open, mq_open_LINKNAME); function Open (Name : POSIX_String; Mode : POSIX.IO.File_Mode; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Masked_Signals : Signal_Masking := RTS_Signals) return Message_Queue_Descriptor is Name_With_NUL : POSIX_String := Name & NUL; Old_Mask : aliased Signal_Mask; Result : Message_Queue_Descriptor; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := mq_open (Name_With_NUL (Name_With_NUL'First)'Unchecked_Access, To_int (Option_Set (Options).Option or C_File_Mode (Mode)), 0, null); return Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Open; ---------------------- -- Open_Or_Create -- ---------------------- function Open_Or_Create (Name : POSIX_String; Mode : POSIX.IO.File_Mode; Permissions : POSIX.Permissions.Permission_Set; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Masked_Signals : Signal_Masking := RTS_Signals) return Message_Queue_Descriptor is Name_With_NUL : POSIX_String := Name & NUL; Old_Mask : aliased Signal_Mask; Result : Message_Queue_Descriptor; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := mq_open (Name_With_NUL (Name_With_NUL'First)'Unchecked_Access, To_int (Option_Set (Options).Option or C_File_Mode (Mode) or O_CREAT), Form_C_Permission (Permissions), null); return Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Open_Or_Create; function Open_Or_Create (Name : POSIX_String; Mode : POSIX.IO.File_Mode; Permissions : POSIX.Permissions.Permission_Set; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Attrs : Attributes; Masked_Signals : Signal_Masking := RTS_Signals) return Message_Queue_Descriptor is Name_With_NUL : POSIX_String := Name & NUL; Old_Mask : aliased Signal_Mask; Result : Message_Queue_Descriptor; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := mq_open (Name_With_NUL (Name_With_NUL'First)'Unchecked_Access, To_int (Option_Set (Options).Option or C_File_Mode (Mode) or O_CREAT), Form_C_Permission (Permissions), Attrs.Attrs'Unchecked_Access); return Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Open_Or_Create; ------------- -- Close -- ------------- procedure Close (MQ : in out Message_Queue_Descriptor) is function mq_close (mqdes : Message_Queue_Descriptor) return int; pragma Import (C, mq_close, mq_close_LINKNAME); begin Check (mq_close (MQ)); end Close; ---------------------------- -- Unlink_Message_Queue -- ---------------------------- procedure Unlink_Message_Queue (Name : POSIX_String) is function mq_unlink (name : char_ptr) return int; pragma Import (C, mq_unlink, mq_unlink_LINKNAME); Name_With_NUL : POSIX_String := Name & NUL; begin Check (mq_unlink (Name_With_NUL (Name_With_NUL'First)'Unchecked_Access)); end Unlink_Message_Queue; ------------ -- Send -- ------------ function mq_send (mqdes : Message_Queue_Descriptor; msg_ptr : char_ptr; msg_len : size_t; msg_prio : unsigned) return int; pragma Import (C, mq_send, mq_send_LINKNAME); procedure Send (MQ : Message_Queue_Descriptor; Message : Ada.Streams.Stream_Element_Array; Priority : Message_Priority; Masked_Signals : Signal_Masking := RTS_Signals) is Old_Mask : aliased Signal_Mask; Result : int; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := mq_send (MQ, To_char_ptr (Message (Message'First)'Address), size_t (Message'Length), unsigned (Priority)); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Send; --------------- -- Receive -- --------------- function mq_receive (mqdes : Message_Queue_Descriptor; msg_ptr : System.Address; msg_len : size_t; msg_prio : access unsigned) return ssize_t; pragma Import (C, mq_receive, mq_receive_LINKNAME); procedure Receive (MQ : Message_Queue_Descriptor; Message : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Priority : out Message_Priority; Masked_Signals : Signal_Masking := RTS_Signals) is Old_Mask : aliased Signal_Mask; Prio : aliased unsigned; Result : ssize_t; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := mq_receive (MQ, Message (Message'First)'Address, size_t (Message'Length), Prio'Unchecked_Access); Check_NNeg_And_Restore_Signals (int (Result), Masked_Signals, Old_Mask'Unchecked_Access); Priority := Message_Priority (Prio); Last := Message'First + Stream_Element_Offset (Result) - 1; end Receive; package body Generic_Message_Queues is SES : constant Stream_Element_Offset := Stream_Element'Size; Buffer_Length : constant Stream_Element_Offset := (Message_Type'Size + SES - 1) / SES; Buffer : aliased Stream_Element_Array (1 .. Buffer_Length); Length : Stream_Element_Offset; ------------ -- Send -- ------------ procedure Send (MQ : Message_Queue_Descriptor; Message : Message_Type; Priority : Message_Priority; Masked_Signals : Signal_Masking := RTS_Signals) is Old_Mask : aliased Signal_Mask; Result : int; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := mq_send (MQ, To_char_ptr (Message'Address), size_t ((Message'Size + char'Size - 1) / char'Size), unsigned (Priority)); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Send; --------------- -- Receive -- --------------- type Message_Ptr is access all Message_Type; function To_Message_Ptr is new Unchecked_Conversion (System.Address, Message_Ptr); procedure Receive (MQ : Message_Queue_Descriptor; Message : out Message_Type; Priority : out Message_Priority; Masked_Signals : Signal_Masking := RTS_Signals) is Old_Mask : aliased Signal_Mask; Prio : aliased unsigned; Result : ssize_t; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := mq_receive (MQ, Buffer'Address, size_t (Buffer'Size / char'Size), Prio'Unchecked_Access); Check_NNeg_And_Restore_Signals (int (Result), Masked_Signals, Old_Mask'Unchecked_Access); Length := Stream_Element_Offset (Result); if Result /= Buffer'Size / char'Size then raise Constraint_Error; end if; Priority := Message_Priority (Prio); Message := To_Message_Ptr (Buffer'Address).all; end Receive; ------------------------ -- Get_Error_Buffer -- ------------------------ function Get_Error_Buffer return Ada.Streams.Stream_Element_Array is begin return Buffer (1 .. Length); end Get_Error_Buffer; end Generic_Message_Queues; ---------------------- -- Request_Notify -- ---------------------- type Event_Ptr is access all POSIX.Signals.Signal_Event; function mq_notify (mqdes : Message_Queue_Descriptor; notification : Event_Ptr) return int; pragma Import (C, mq_notify, mq_notify_LINKNAME); procedure Request_Notify (MQ : Message_Queue_Descriptor; Event : POSIX.Signals.Signal_Event) is E : aliased POSIX.Signals.Signal_Event := Event; begin Check (mq_notify (MQ, E'Unchecked_Access)); end Request_Notify; --------------------- -- Remove_Notify -- --------------------- procedure Remove_Notify (MQ : Message_Queue_Descriptor) is begin Check (mq_notify (MQ, null)); end Remove_Notify; ---------------------- -- Set_Attributes -- ---------------------- function mq_setattr (mqdes : Message_Queue_Descriptor; mqstat : mq_attr_ptr; omqstat : mq_attr_ptr) return int; pragma Import (C, mq_setattr, mq_setattr_LINKNAME); procedure Set_Attributes (MQ : Message_Queue_Descriptor; New_Attrs : Attributes; Old_Attrs : out Attributes) is begin Check (mq_setattr (MQ, New_Attrs.Attrs'Unchecked_Access, Old_Attrs.Attrs'Unchecked_Access)); end Set_Attributes; ---------------------- -- Set_Attributes -- ---------------------- procedure Set_Attributes (MQ : Message_Queue_Descriptor; New_Attrs : Attributes) is begin Check (mq_setattr (MQ, New_Attrs.Attrs'Unchecked_Access, null)); end Set_Attributes; ---------------------- -- Get_Attributes -- ---------------------- function Get_Attributes (MQ : Message_Queue_Descriptor) return Attributes is function mq_getattr (mqdes : Message_Queue_Descriptor; mqstat : access struct_mq_attr) return int; pragma Import (C, mq_getattr, mq_getattr_LINKNAME); Attrs : Attributes; begin Check (mq_getattr (MQ, Attrs.Attrs'Unchecked_Access)); return Attrs; end Get_Attributes; end POSIX.Message_Queues; florist-gpl-2017-src/libsrc/threads/posix-asynchronous_io.ads0000644000076700001450000001635113106553472024006 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . A S Y N C H R O N O U S _ I O -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.IO, POSIX.Signals; package POSIX.Asynchronous_IO is type AIO_Descriptor is private; function Create_AIO_Control_Block return AIO_Descriptor; procedure Destroy_AIO_Control_Block (AD : in out AIO_Descriptor); type List_IO_Operations is (No_Op, Read, Write); type IO_Array_Pointer is access Ada.Streams.Stream_Element_Array; for IO_Array_Pointer'Size use Standard'Address_Size; -- force this to be a "thin" pointer, like C pointers function Get_File (AD : AIO_Descriptor) return POSIX.IO.File_Descriptor; procedure Set_File (AD : AIO_Descriptor; File : POSIX.IO.File_Descriptor); function Get_Offset (AD : AIO_Descriptor) return POSIX.IO.IO_Offset; procedure Set_Offset (AD : AIO_Descriptor; Offset : POSIX.IO.IO_Offset); function Get_Buffer (AD : AIO_Descriptor) return IO_Array_Pointer; procedure Set_Buffer (AD : AIO_Descriptor; Buffer : IO_Array_Pointer); function Get_Length (AD : AIO_Descriptor) return POSIX.IO_Count; procedure Set_Length (AD : AIO_Descriptor; Length : POSIX.IO_Count); function Get_Priority_Reduction (AD : AIO_Descriptor) return Natural; procedure Set_Priority_Reduction (AD : AIO_Descriptor; Priority_Reduction : Natural); function Get_Event (AD : AIO_Descriptor) return POSIX.Signals.Signal_Event; procedure Set_Event (AD : AIO_Descriptor; Event : POSIX.Signals.Signal_Event); function Get_Operation (AD : AIO_Descriptor) return List_IO_Operations; procedure Set_Operation (AD : AIO_Descriptor; Operation : List_IO_Operations); procedure Read (AD : AIO_Descriptor); procedure Write (AD : AIO_Descriptor); type AIO_Descriptor_List is array (Positive range <>) of aliased AIO_Descriptor; -- .... "aliased" is not in POSIX.5b -- ????? Change POSIX.5b? -- This array should probably have been a private (or limited private) -- type, so that we could hide a copy of the C-style array of pointers -- inside the object. As things stand, the need to be able to recover -- an Ada pointer to the buffer of each AIOCB is forcing us to put a -- wrapper around each AIOCB pointer, and so we cannot pass the array -- directly as argument to any C system call. Instead, we have to -- dynamically create a C-style array at the point of call. procedure List_IO_No_Wait (List : in out AIO_Descriptor_List; Event : POSIX.Signals.Signal_Event); procedure List_IO_Wait (List : in out AIO_Descriptor_List; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); type AIO_Status is (In_Progress, Completed_Successfully, Canceled); function Get_AIO_Status (AD : AIO_Descriptor) return AIO_Status; function Get_AIO_Error_Code (AD : AIO_Descriptor) return POSIX.Error_Code; function Get_Bytes_Transferred (AD : AIO_Descriptor) return POSIX.IO_Count; type Cancelation_Status is (Canceled, Not_Canceled, All_Done); function Cancel (AD : AIO_Descriptor) return Cancelation_Status; function Cancel (File : POSIX.IO.File_Descriptor) return Cancelation_Status; procedure Await_IO_Or_Timeout (AD : AIO_Descriptor; Timeout : POSIX.Timespec; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Await_IO (AD : AIO_Descriptor; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Await_IO_Or_Timeout (List : AIO_Descriptor_List; Timeout : POSIX.Timespec; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Await_IO (List : AIO_Descriptor_List; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Synchronize_File (AD : AIO_Descriptor); procedure Synchronize_Data (AD : AIO_Descriptor); private -- The following wrapper is needed around the C struct aiocb -- in order to preserve the Ada "fat" pointer (including constraint info) -- that we need in order to be able to recover the range constraint of the -- Stream_Element_Array object referenced by the aiocb. -- Our code is going to rely on the component C being allocated in first -- position. There will be code in the package body to verify this -- assumption. type Aiocb_Wrapper is record C : aliased POSIX.C.struct_aiocb; P : IO_Array_Pointer; end record; type AIO_Descriptor is access Aiocb_Wrapper; end POSIX.Asynchronous_IO; florist-gpl-2017-src/libsrc/threads/posix-timers-extensions.ads0000644000076700001450000000567013106553472024266 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . T I M E R S . E X T E N S I O N S -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- This file contains system-dependent (and therefore non-portable) -- extensions to POSIX.Timers. package POSIX.Timers.Extensions is function Clock_SGI_Fast return Clock_ID; -- Only available under IRIX systems. -- Return an invalid ID on non IRIX systems. -- This clock has a higher resolution than Clock_Realtime and is -- available to priviledged users only. This clock is SGI -- specific and is not portable. end POSIX.Timers.Extensions; florist-gpl-2017-src/libsrc/threads/posix_condition_variables.ads0000644000076700001450000000600313106553472024655 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ C O N D I T I O N _ V A R I A B L E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 1991-1994 Florida State University -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Condition_Variables; pragma Elaborate_All (POSIX.Condition_Variables); package POSIX_Condition_Variables renames POSIX.Condition_Variables; florist-gpl-2017-src/libsrc/threads/posix_signals.ads0000644000076700001450000000560413106553472022305 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ S I G N A L S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Signals; pragma Elaborate_All (POSIX.Signals); package POSIX_Signals renames POSIX.Signals; florist-gpl-2017-src/libsrc/threads/posix-signals.adb0000644000076700001450000011551213106553472022202 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . S I G N A L S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2013, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- Please take care in future maintenance updates to avoid adding -- direct system calls that modify the signal action or signal -- masking, and to coordinate changes with the GNAT runtime. -- The implementation of this package is closely dependent on the -- GNAT packages System.Interrupts, and -- System.Interrupt_Management. See comments in those packages -- for related explanation of the design for signal handling. -- Unfortunately, this means maintenance changes to Florist and -- GNAT need to be synchronized. A person with an older version of -- GNAT will have problems using the current version of Florist. -- The present design is a compromise. If it were not for the -- backward compatibility issue, all of the necessary POSIX -- signal management support would be implemented directly in -- the package System.Interrupts. (That was the original design.) -- We have tried to avoid changing the GNARL runtime system package -- interfaces, in order that it would be possible to compile Florist -- using earlier versions of GNAT. This has meant in some cases -- putting the implementation of new functionality (e.g., the -- POSIX.5b Interrupt_Task and the POSIX.5c Install_Empty_Handler) -- directly into the body of POSIX.Signals. As a result, the -- functionality is now divided between the two packages, in a -- way that may not make much sense to a new reader. -- With luck, it should be possible to compile this version of Florist -- with earlier versions of GNAT. There will a variable degree of -- effect on the functioning of the signal management interfaces. -- Since there were significant defects in this part of earlier releases -- of Florist (detected by the POSIX.5b validation tests), we hope -- no earlier Florist users are dependent on the way these operations -- "worked" before. We had to make the changes. -- Ideally, there should be no operations in here that directly modify the -- signal state of the process or thread. For safety, all such operations -- should be implemented by calls to operations in System.Interrupts. -- Otherwise, we could break invariants upon which the Ada tasking -- runtime system depends. However, to allow this version of Florist -- to be used with earlier versions of GNAT, there are some places where -- direct system calls are done. People doing maintenance should beware -- of adding other direct calls without careful analysis of how they -- might interact with what the GNAT runtime system is doing. with POSIX.Implementation, System.Tasking, System.Interrupts, System.Task_Primitives.Operations, Unchecked_Conversion; package body POSIX.Signals is use POSIX.C, POSIX.Implementation, System, System.Storage_Elements, System.Tasking; package SI renames System.Interrupts; subtype SIID is SI.Interrupt_ID; package Bogus_Signal_Enum is package PS renames POSIX.Signals; type Signal_Name_Enum is (Signal_Null, SIGNULL, Signal_Abort, SIGABRT, Signal_Alarm, SIGALRM, Signal_Bus_Error, SIGBUS, Signal_Floating_Point_Error, SIGFPE, Signal_Hangup, SIGHUP, Signal_Illegal_Instruction, SIGILL, Signal_Interrupt, SIGINT, Signal_Kill, SIGKILL, Signal_Pipe_Write, SIGPIPE, Signal_Quit, SIGQUIT, Signal_Segmentation_Violation, SIGSEGV, Signal_Terminate, SIGTERM, Signal_User_1, SIGUSR1, Signal_User_2, SIGUSR2, Signal_Child, SIGCHLD, Signal_Continue, SIGCONT, Signal_Stop, SIGSTOP, Signal_Terminal_Stop, SIGTSTP, Signal_Terminal_Input, SIGTTIN, Signal_Terminal_Output, SIGTTOU, Signal_IO, SIGIO, Signal_Out_Of_Band_Data, SIGURG); Enum_To_Signal : array (Signal_Name_Enum'Range) of Signal := (Signal_Null => 0, SIGNULL => 0, Signal_Abort => PS.SIGABRT, SIGABRT => PS.SIGABRT, Signal_Alarm => PS.SIGALRM, SIGALRM => PS.SIGALRM, Signal_Bus_Error => PS.SIGBUS, SIGBUS => PS.SIGBUS, Signal_Floating_Point_Error => PS.SIGFPE, SIGFPE => PS.SIGFPE, Signal_Hangup => PS.SIGHUP, SIGHUP => PS.SIGHUP, Signal_Illegal_Instruction => PS.SIGILL, SIGILL => PS.SIGILL, Signal_Interrupt => PS.SIGINT, SIGINT => PS.SIGINT, Signal_Kill => PS.SIGKILL, SIGKILL => PS.SIGKILL, Signal_Pipe_Write => PS.SIGPIPE, SIGPIPE => PS.SIGPIPE, Signal_Quit => PS.SIGQUIT, SIGQUIT => PS.SIGQUIT, Signal_Segmentation_Violation => PS.SIGSEGV, SIGSEGV => PS.SIGSEGV, Signal_Terminate => PS.SIGTERM, SIGTERM => PS.SIGTERM, Signal_User_1 => PS.SIGUSR1, SIGUSR1 => PS.SIGUSR1, Signal_User_2 => PS.SIGUSR2, SIGUSR2 => PS.SIGUSR2, Signal_Child => PS.SIGCHLD, SIGCHLD => PS.SIGCHLD, Signal_Continue => PS.SIGCONT, SIGCONT => PS.SIGCONT, Signal_Stop => PS.SIGSTOP, SIGSTOP => PS.SIGSTOP, Signal_Terminal_Stop => PS.SIGTSTP, SIGTSTP => PS.SIGTSTP, Signal_Terminal_Input => PS.SIGTTIN, SIGTTIN => PS.SIGTTIN, Signal_Terminal_Output => PS.SIGTTOU, SIGTTOU => PS.SIGTTOU, Signal_IO => PS.SIGIO, SIGIO => PS.SIGIO, Signal_Out_Of_Band_Data => PS.SIGURG, SIGURG => PS.SIGURG); Signal_To_Enum : array (Signal'Range) of Signal_Name_Enum := (0 => Signal_Null, PS.SIGABRT => Signal_Abort, PS.SIGALRM => Signal_Alarm, PS.SIGBUS => Signal_Bus_Error, PS.SIGFPE => Signal_Floating_Point_Error, PS.SIGHUP => Signal_Hangup, PS.SIGILL => Signal_Illegal_Instruction, PS.SIGINT => Signal_Interrupt, PS.SIGKILL => Signal_Kill, PS.SIGPIPE => Signal_Pipe_Write, PS.SIGQUIT => Signal_Quit, PS.SIGSEGV => Signal_Segmentation_Violation, PS.SIGTERM => Signal_Terminate, PS.SIGUSR1 => Signal_User_1, PS.SIGUSR2 => Signal_User_2, PS.SIGCHLD => Signal_Child, PS.SIGCONT => Signal_Continue, PS.SIGSTOP => Signal_Stop, PS.SIGTSTP => Signal_Terminal_Stop, PS.SIGTTIN => Signal_Terminal_Input, PS.SIGTTOU => Signal_Terminal_Output, PS.SIGIO => Signal_IO, PS.SIGURG => Signal_Out_Of_Band_Data, others => Signal_Null); end Bogus_Signal_Enum; use Bogus_Signal_Enum; ------------------ -- Global Data -- ------------------ type Signal_Bit_Vector is array (Signal) of Boolean; -- Reserved_Signal is the union of the following sets of -- signals: -- (1) The reserved signals, as defined -- by the POSIX.5 standard. The reserved signals -- include the named required reserved signals, plus any other -- signals that are reserved by the implementation. -- (2) The signals for which the -- implementation does not allow us to set the action. -- (3) The signals for which sigwait is not safe. -- (4) The set of signals, as defined by -- the Ada runtime system, for which it is unsafe to call -- System.Interrupt_Management.Ignore_Signal. -- (5) The set of signals, as defined by -- the Ada runtime system, for which user-defined signal entries -- are not supported. -- (6) The set of signals, as defined by -- the Ada runtime system, for which it is unsafe to call -- System.Interrupt_Management.Block_Signals. -- This constant is initialized -- in the begin-end block of the package body, below, because -- it depends on values in POSIX.Implementation.OK_Signals. Reserved_Signal : Signal_Bit_Vector; -- Signal_Disposition is use by Set_Blocked_Signals, to decide who -- should mask or unmask a given signal. type Signal_Disposition is (No_Change, SI_To_Mask, SI_To_Unmask); ------------------------ -- Local Subprograms -- ------------------------ function To_pid_t is new Unchecked_Conversion (POSIX.Process_Identification.Process_ID, pid_t); function To_pid_t is new Unchecked_Conversion (POSIX.Process_Identification.Process_Group_ID, pid_t); function Convert_Ids is new Unchecked_Conversion (Ada.Task_Identification.Task_Id, System.Tasking.Task_Id); function To_Signal_Data is new Unchecked_Conversion (sigval, Signal_Data); function To_sigval is new Unchecked_Conversion (Signal_Data, sigval); function sigismember (set : sigset_t_ptr; sig : int) return int; pragma Import (C, sigismember, sigismember_LINKNAME); function sigaddset (set : access sigset_t; sig : int) return int; pragma Import (C, sigaddset, sigaddset_LINKNAME); function sigfillset (set : access sigset_t) return int; pragma Import (C, sigfillset, sigfillset_LINKNAME); function sigemptyset (set : access sigset_t) return int; pragma Import (C, sigemptyset, sigemptyset_LINKNAME); function sigdelset (set : access sigset_t; sig : int) return int; pragma Import (C, sigdelset, sigdelset_LINKNAME); function sigpending (set : sigset_t_ptr) return int; pragma Import (C, sigpending, sigpending_LINKNAME); function sigaction (sig : int; act : sigaction_ptr; oact : sigaction_ptr) return int; pragma Import (C, sigaction, sigaction_LINKNAME); function pthread_sigmask (how : int; set : sigset_t_ptr; oset : sigset_t_ptr) return int; pragma Import (C, pthread_sigmask, pthread_sigmask_LINKNAME); function sigwait (set : sigset_t_ptr; sig : int_ptr) return int; pragma Import (C, sigwait, sigwait_LINKNAME); function sigwaitinfo (set : sigset_t_ptr; info : siginfo_t_ptr) return int; pragma Import (C, sigwaitinfo, sigwaitinfo_LINKNAME); function sigtimedwait (set : sigset_t_ptr; info : siginfo_t_ptr; timeout : timespec_ptr) return int; pragma Import (C, sigtimedwait, sigtimedwait_LINKNAME); procedure Check_Awaitable (Set : Signal_Set); pragma Inline (Check_Awaitable); procedure Null_Handler; pragma Convention (C, Null_Handler); procedure Void (Ignore : int); pragma Inline (Void); -- The Await_Signal operations report Invalid_Argument for -- the reserved signals and for signals that are attached to -- a task entry. By extension, we treat signals that are -- attached to protected procedures as if they were attached -- to a task entry. procedure Check_Awaitable (Set : Signal_Set) is begin for Sig in Signal loop if Reserved_Signal (Sig) then if Sig /= SIGKILL and then Sig /= SIGSTOP and then sigismember (Set.C'Unchecked_Access, int (Sig)) = 1 then Raise_POSIX_Error (Invalid_Argument); end if; else -- This signal might be attached to a -- task entry or protected procedure if sigismember (Set.C'Unchecked_Access, int (Sig)) = 1 and then (SI.Is_Entry_Attached (SIID (Sig)) or else SI.Is_Handler_Attached (SIID (Sig))) then Raise_POSIX_Error (Invalid_Argument); end if; end if; end loop; end Check_Awaitable; procedure Null_Handler is begin null; end Null_Handler; procedure Void (Ignore : int) is pragma Warnings (Off, Ignore); begin null; end Void; ---------------------------------------- -- Signal_Set Initialize and Finalize -- ---------------------------------------- procedure Initialize (Set : in out Signal_Set) is begin Void (sigemptyset (Set.C'Unchecked_Access)); end Initialize; procedure Finalize (Set : in out Signal_Set) is begin Void (sigemptyset (Set.C'Unchecked_Access)); end Finalize; ----------- -- Image -- ----------- function Image (Sig : Signal) return String is Tmp : constant Signal_Name_Enum := Signal_To_Enum (Sig); begin if Tmp = Bogus_Signal_Enum.Signal_Null and then Sig /= 0 then declare Img : constant String := Signal'Image (Sig); begin return "SIGNAL_" & Img (Img'First + 1 .. Img'Last); end; else return Signal_Name_Enum'Image (Tmp); end if; end Image; ----------- -- Value -- ----------- function Value (Str : String) return Signal is A : constant Positive := Str'First; begin if Str'Length > 7 and then Str (A .. A + 6) = "SIGNAL_" and then Str (A + 7) in '0' .. '9' then return Signal'Value (Str (A + 7 .. Str'Last)); else return Enum_To_Signal (Signal_Name_Enum'Value (Str)); end if; end Value; ---------------- -- Add_Signal -- ---------------- procedure Add_Signal (Set : in out Signal_Set; Sig : Signal) is begin if Sig /= Signal_Null then Void (sigaddset (Set.C'Unchecked_Access, int (Sig))); end if; -- Signal_Null (i.e., zero) is implicitly a member of every set. end Add_Signal; -------------------- -- Add_All_Signal -- -------------------- procedure Add_All_Signals (Set : in out Signal_Set) is begin Void (sigfillset (Set.C'Unchecked_Access)); end Add_All_Signals; ------------------- -- Delete_Signal -- ------------------- procedure Delete_Signal (Set : in out Signal_Set; Sig : Signal) is begin if Sig /= Signal_Null then Void (sigdelset (Set.C'Unchecked_Access, int (Sig))); end if; end Delete_Signal; ------------------------ -- Delete_All_Signals -- ------------------------ procedure Delete_All_Signals (Set : in out Signal_Set) is begin if sigemptyset (Set.C'Unchecked_Access) = 0 then null; end if; end Delete_All_Signals; --------------- -- Is_Member -- --------------- function Is_Member (Set : Signal_Set; Sig : Signal) return Boolean is begin if Sig = Signal_Null or else sigismember (Set.C'Unchecked_Access, int (Sig)) = 1 then return True; end if; return False; end Is_Member; ----------------------------------- -- Set_Blocked_Signals -- ----------------------------------- -- The operations that block/unblock signals do not raise an -- exception for any reserved or uncatchable signals, but -- quietly have no effect on the masking of SIGKILL, SIGSTOP, -- and the reserved signals. procedure Set_Blocked_Signals (New_Mask : Signal_Set; Old_Mask : out Signal_Set) is os_new_mask : aliased sigset_t; Prev_Mask : Signal_Set; Disposition : array (Signal) of Signal_Disposition := (others => No_Change); begin Begin_Critical_Section; Prev_Mask := Blocked_Signals; Void (pthread_sigmask (SIG_SETMASK, null, os_new_mask'Unchecked_Access)); -- Partition the signals between those that -- are managed by System.Interrupts and those that we manage -- directly here. for Sig in Signal loop if not Reserved_Signal (Sig) then -- It is OK to modify this signal's masking, using the -- interfaces of System.Interrupts. if sigismember (New_Mask.C'Unchecked_Access, int (Sig)) = 1 then if not SI.Is_Blocked (SIID (Sig)) then Disposition (Sig) := SI_To_Mask; end if; else if SI.Is_Blocked (SIID (Sig)) then Disposition (Sig) := SI_To_Unmask; end if; end if; end if; end loop; -- Update the record of which task has which signal unblocked. for Sig in Signal loop case Disposition (Sig) is when No_Change => null; when SI_To_Mask => SI.Block_Interrupt (SIID (Sig)); -- ???? Rely that no exception can be raised, due to previous -- checks? Otherwise, we need to provide a handler to end the -- critical section. when SI_To_Unmask => SI.Unblock_Interrupt (SIID (Sig)); -- ???? Rely that no exception can be raised, due to previous -- checks? Otherwise, we need to provide a handler to end the -- critical section. end case; end loop; End_Critical_Section; Old_Mask := Prev_Mask; end Set_Blocked_Signals; --------------------- -- Block_Signals -- --------------------- procedure Block_Signals (Mask_to_Add : Signal_Set; Old_Mask : out Signal_Set) is os_new_mask : aliased sigset_t; Prev_Mask : Signal_Set; Disposition : array (Signal) of Signal_Disposition := (others => No_Change); begin Begin_Critical_Section; Prev_Mask := Blocked_Signals; Void (sigemptyset (os_new_mask'Unchecked_Access)); for Sig in Signal loop if not Reserved_Signal (Sig) then -- It is OK to modify this signal's masking, using the -- interfaces of System.Interrupts. if sigismember (Mask_to_Add.C'Unchecked_Access, int (Sig)) = 1 then if not SI.Is_Blocked (SIID (Sig)) then Disposition (Sig) := SI_To_Mask; end if; else null; end if; end if; end loop; -- Update the record of which task has which signal unblocked. for Sig in Signal loop case Disposition (Sig) is when No_Change => null; when SI_To_Mask => SI.Block_Interrupt (SIID (Sig)); -- ???? Rely that no exception can be raised, due to previous -- checks? Otherwise, we need to provide a handler to end the -- critical section. when SI_To_Unmask => -- Should never get here! raise Program_Error; end case; end loop; End_Critical_Section; Old_Mask := Prev_Mask; end Block_Signals; ----------------------- -- Unblock_Signals -- ----------------------- procedure Unblock_Signals (Mask_to_Subtract : Signal_Set; Old_Mask : out Signal_Set) is os_new_mask : aliased sigset_t; Prev_Mask : Signal_Set; Disposition : array (Signal) of Signal_Disposition := (others => No_Change); begin Begin_Critical_Section; Prev_Mask := Blocked_Signals; Void (sigemptyset (os_new_mask'Unchecked_Access)); -- Partition the signals between those that -- are managed by System.Interrupts and those that we manage -- directly here. for Sig in Signal loop if not Reserved_Signal (Sig) then -- It is OK to modify this signal's masking, using the -- interfaces of System.Interrupts. if sigismember (Mask_to_Subtract.C'Unchecked_Access, int (Sig)) = 1 then if SI.Is_Blocked (SIID (Sig)) then Disposition (Sig) := SI_To_Unmask; end if; end if; end if; end loop; -- Update the record of which task has which signal unblocked. for Sig in Signal loop case Disposition (Sig) is when No_Change => null; when SI_To_Mask => raise Program_Error; -- Should never get here! when SI_To_Unmask => SI.Unblock_Interrupt (SIID (Sig)); -- ???? Rely that no exception can be raised, due to previous -- checks? Otherwise, we need to provide a handler to end the -- critical section. end case; end loop; End_Critical_Section; Old_Mask := Prev_Mask; end Unblock_Signals; ----------------------- -- Blocked_Signals -- ----------------------- function Blocked_Signals return Signal_Set is Old_Mask : Signal_Set; begin -- Get thread-level signal mask, directly from OS, since -- for a badly matched GNARL and operating system, there -- may be more values in POSIX.Signal -- than System.Interrupts.Interrupt_ID if pthread_sigmask (SIG_BLOCK, null, Old_Mask.C'Unchecked_Access) = 0 then null; end if; -- Delete any ublocked signals from System.Interrupts. for Sig in Signal loop if not Reserved_Signal (Sig) then if SI.Is_Blocked (SIID (Sig)) then null; -- Void (sigaddset (Old_Mask.C'Unchecked_Access, int (Sig))); -- Rely that we cannot have a signal that is unmasked -- in the current thread and is also logically -- blocked by the signal manager. else Void (sigdelset (Old_Mask.C'Unchecked_Access, int (Sig))); end if; end if; end loop; return Old_Mask; end Blocked_Signals; ------------------- -- Ignore_Signal -- ------------------- -- The signal ignoring/unignoring operations report -- Invalid_Operation for SIGKILL, SIGSTOP, the reserved signals, -- Signal_Null, or any other signals for which the signal action -- is not permitted to be set by an application. procedure Ignore_Signal (Sig : Signal) is begin if Reserved_Signal (Sig) then Raise_POSIX_Error (Invalid_Argument); else SI.Ignore_Interrupt (SIID (Sig)); end if; end Ignore_Signal; --------------------- -- Unignore_Signal -- --------------------- procedure Unignore_Signal (Sig : Signal) is begin if Reserved_Signal (Sig) then Raise_POSIX_Error (Invalid_Argument); else SI.Unignore_Interrupt (SIID (Sig)); end if; end Unignore_Signal; ---------------- -- Is_Ignored -- ---------------- function Is_Ignored (Sig : Signal) return Boolean is act : aliased struct_sigaction; begin if Reserved_Signal (Sig) then Raise_POSIX_Error (Invalid_Argument); return False; else Check (sigaction (int (Sig), null, act'Unchecked_Access)); return act.sa_handler = To_Address (SIG_IGN); end if; end Is_Ignored; --------------------------- -- Install_Empty_Handler -- --------------------------- -- This is a POSIX.5c addition. -- .... This functionality needs to be merged into the -- Ada runtime system (s-interr.adb) so as to ensure mutual -- exclusion between these changes to signal handler state -- and changes that are done there. -- The best solution may be to export operations for -- locking/unlocking, rather than to add new entries to the -- signal manager task. procedure Install_Empty_Handler (Sig : Signal) is act, oact : aliased struct_sigaction; Result : int; begin if Reserved_Signal (Sig) then Raise_POSIX_Error (Invalid_Argument); end if; Begin_Critical_Section; act.sa_flags := 0; act.sa_handler := Null_Handler'Address; Check (sigemptyset (act.sa_mask'Unrestricted_Access)); Result := sigaction (int (Sig), act'Unchecked_Access, oact'Unchecked_Access); End_Critical_Section; Check (Result); end Install_Empty_Handler; ------------------------------ -- Set_Stopped_Child_Signal -- ------------------------------ -- .... This functionality needs to be merged into the -- Ada runtime system (s-interr.adb) so as to ensure mutual -- exclusion between these changes to signal handler state -- and changes that are done there. -- The best solution may be to export operations for -- locking/unlocking, rather than to add new entries to the -- signal manager task. procedure Set_Stopped_Child_Signal (Enable : Boolean := True) is Action, Oact : aliased struct_sigaction; Result : int; begin Begin_Critical_Section; -- ... Need to coordinate with System.Interrupts -- to enforce mutual exclusion on signal state changes Result := sigaction (POSIX.C.SIGCHLD, null, Oact'Unchecked_Access); if Result /= -1 then Action := Oact; -- .... need to check that this feature is really supported -- and raise POSIX_Error, if it is not, else we will have some -- strange effects from the default values of these constants!! -- In general, should look at various systems to see which features -- are not supported, and make sure we are fail-safe if those -- features are missing. if Enable then Action.sa_flags := int (Bits (Action.sa_flags) and not SA_NOCLDSTOP); else Action.sa_flags := int (Bits (Action.sa_flags) or SA_NOCLDSTOP); end if; Result := sigaction (POSIX.C.SIGCHLD, Action'Unchecked_Access, Oact'Unchecked_Access); end if; End_Critical_Section; Check (Result); end Set_Stopped_Child_Signal; ---------------------------------- -- Stopped_Child_Signal_Enabled -- ---------------------------------- function Stopped_Child_Signal_Enabled return Boolean is Action : aliased struct_sigaction; Result : int; begin Begin_Critical_Section; Result := sigaction (POSIX.C.SIGCHLD, null, Action'Unchecked_Access); End_Critical_Section; Check (Result); return ((Bits (Action.sa_flags) and SA_NOCLDSTOP) = 0); end Stopped_Child_Signal_Enabled; --------------------- -- Pending_Signals -- --------------------- function Pending_Signals return Signal_Set is Set : Signal_Set; Result : int; begin Begin_Critical_Section; Result := sigpending (Set.C'Unchecked_Access); End_Critical_Section; Check (Result); return Set; end Pending_Signals; ------------------ -- Get_Signal -- ------------------ function Get_Signal (Event : Signal_Event) return Signal is begin return Signal (Event.sigev_signo); end Get_Signal; ------------------ -- Set_Signal -- ------------------ procedure Set_Signal (Event : in out Signal_Event; Sig : Signal) is begin Event.sigev_signo := int (Sig); end Set_Signal; ------------------------ -- Get_Notification -- ------------------------ function Get_Notification (Event : Signal_Event) return Notification is begin return Notification (Event.sigev_notify); end Get_Notification; ------------------------ -- Set_Notification -- ------------------------ procedure Set_Notification (Event : in out Signal_Event; Notify : Notification) is begin Event.sigev_notify := int (Notify); end Set_Notification; ---------------- -- Get_Data -- ---------------- function Get_Data (Event : Signal_Event) return Signal_Data is begin return To_Signal_Data (Event.sigev_value); end Get_Data; ---------------- -- Set_Data -- ---------------- procedure Set_Data (Event : in out Signal_Event; Data : Signal_Data) is begin Event.sigev_value := To_sigval (Data); end Set_Data; ------------------ -- Get_Signal -- ------------------ function Get_Signal (Info : Signal_Info) return Signal is begin return Signal (Info.si_signo); end Get_Signal; ------------------ -- Set_Signal -- ------------------ procedure Set_Signal (Info : in out Signal_Info; Sig : Signal) is begin Info.si_signo := int (Sig); end Set_Signal; ------------------ -- Get_Source -- ------------------ function Get_Source (Info : Signal_Info) return Signal_Source is begin return Signal_Source (Info.si_code); end Get_Source; ------------------ -- Set_Source -- ------------------ procedure Set_Source (Info : in out Signal_Info; Source : Signal_Source) is begin Info.si_code := int (Source); end Set_Source; ---------------- -- Has_Data -- ---------------- function Has_Data (Source : Signal_Source) return Boolean is begin return (Source = From_Queue_Signal) or (Source = From_Async_IO) or (Source = From_Message_Queue) or (Source = From_Timer); end Has_Data; ---------------- -- Get_Data -- ---------------- function Get_Data (Info : Signal_Info) return Signal_Data is begin return To_Signal_Data (Info.si_value); end Get_Data; ---------------- -- Set_Data -- ---------------- procedure Set_Data (Info : in out Signal_Info; Data : Signal_Data) is begin Info.si_value := To_sigval (Data); end Set_Data; ----------------------- -- Enable_Queueing -- ----------------------- -- .... POSIX.5 needs fixing here, to reflect the fact that -- Enabling/Disabling queueing on a signal might not have -- any effect unless there is a handler (even null) installed, -- or to require that this operation install a null handler, -- as a side-effect. -- .... This functionality needs to be merged into the -- Ada runtime system (s-interr.adb) so as to ensure mutual -- exclusion between these changes to signal handler state -- and changes that are done there. -- The best solution may be to export operations for -- locking/unlocking, rather than to add new entries to the -- signal manager task. procedure Enable_Queueing (Sig : Signal) is Action : aliased struct_sigaction; Result : int; begin if not HAVE_sigqueue then Raise_POSIX_Error (Operation_Not_Supported); end if; Begin_Critical_Section; Result := sigaction (int (Sig), null, Action'Unchecked_Access); if Result /= -1 then Action.sa_flags := int (Bits (Action.sa_flags) or SA_SIGINFO); Result := sigaction (int (Sig), Action'Unchecked_Access, null); end if; End_Critical_Section; Check (Result); end Enable_Queueing; ------------------------ -- Disable_Queueing -- ------------------------ procedure Disable_Queueing (Sig : Signal) is Action : aliased struct_sigaction; Result : int; begin if not HAVE_sigqueue then Raise_POSIX_Error (Operation_Not_Supported); end if; Begin_Critical_Section; Result := sigaction (int (Sig), null, Action'Unchecked_Access); if Result /= -1 then Action.sa_flags := int (Bits (Action.sa_flags) and not SA_SIGINFO); Result := sigaction (int (Sig), Action'Unchecked_Access, null); end if; End_Critical_Section; end Disable_Queueing; -------------------- -- Await_Signal -- -------------------- function Await_Signal (Set : Signal_Set) return Signal is Result : aliased int; begin Check_Awaitable (Set); if sigwait (Set.C'Unchecked_Access, Result'Unchecked_Access) = -1 then Raise_POSIX_Error (Fetch_Errno); end if; return Signal (Result); end Await_Signal; ------------------------------- -- Await_Signal_Or_Timeout -- ------------------------------- function Await_Signal_Or_Timeout (Set : Signal_Set; Timeout : POSIX.Timespec) return Signal is begin return Signal (Await_Signal_Or_Timeout (Set, Timeout).si_signo); end Await_Signal_Or_Timeout; -------------------- -- Await_Signal -- -------------------- function Await_Signal (Set : Signal_Set) return Signal_Info is Info : aliased siginfo_t; begin Check_Awaitable (Set); Check (sigwaitinfo (Set.C'Unchecked_Access, Info'Unchecked_Access)); return Signal_Info (Info); end Await_Signal; ------------------------------- -- Await_Signal_Or_Timeout -- ------------------------------- function Await_Signal_Or_Timeout (Set : Signal_Set; Timeout : POSIX.Timespec) return Signal_Info is c_timeout : aliased struct_timespec; Info : aliased siginfo_t; S : Seconds; NS : Nanoseconds; begin Check_Awaitable (Set); Split (Timeout, S, NS); c_timeout.tv_sec := time_t (S); c_timeout.tv_nsec := long (NS); Check (sigtimedwait (Set.C'Unchecked_Access, Info'Unchecked_Access, c_timeout'Unchecked_Access)); return Signal_Info (Info); end Await_Signal_Or_Timeout; ------------------------ -- Signal_Reference -- ------------------------ function Signal_Reference (Sig : Signal) return System.Address is begin -- Signal_Reference reports Invalid_Argument if signal entries -- are not supported for the specified signal. if Reserved_Signal (Sig) then Raise_POSIX_Error (Invalid_Argument); end if; return To_Address (Integer_Address (Sig)); end Signal_Reference; ----------------- -- Send_Signal -- ----------------- function kill (pid : pid_t; sig : C.int) return int; pragma Import (C, kill, kill_LINKNAME); procedure Send_Signal (Process : POSIX.Process_Identification.Process_ID; Sig : Signal) is begin Check (kill (To_pid_t (Process), int (Sig))); end Send_Signal; ----------------- -- Send_Signal -- ----------------- procedure Send_Signal (Group : POSIX.Process_Identification.Process_Group_ID; Sig : Signal) is begin Check (kill (-To_pid_t (Group), int (Sig))); end Send_Signal; ----------------- -- Send_Signal -- ----------------- procedure Send_Signal (Sig : Signal) is begin Check (kill (0, int (Sig))); end Send_Signal; -------------------- -- Queue_Signal -- -------------------- function sigqueue (pid : pid_t; signo : int; value : sigval) return int; pragma Import (C, sigqueue, sigqueue_LINKNAME); procedure Queue_Signal (Process : POSIX.Process_Identification.Process_ID; Sig : Signal; Data : Signal_Data) is begin Check (sigqueue (To_pid_t (Process), int (Sig), To_sigval (Data))); end Queue_Signal; ---------------------- -- Interrupt_Task -- ---------------------- procedure Interrupt_Task (T : Ada.Task_Identification.Task_Id) is begin System.Task_Primitives.Operations.Abort_Task (Convert_Ids (T)); end Interrupt_Task; begin Reserved_Signal := (others => False); for Sig in Signal loop case Sig is when SIGALRM | SIGBUS | SIGILL | SIGSEGV | SIGFPE | SIGABRT => Reserved_Signal (Sig) := True; when SIGKILL | SIGSTOP => Reserved_Signal (Sig) := True; when others => Reserved_Signal (Sig) := not POSIX.Implementation.OK_Signals.OK (Integer (Sig)); end case; end loop; -- Merge in signals that are reserved by the Ada runtime system. for Sig in Signal loop pragma Warnings (Off); -- Kill warning about condition being always true generated -- on some platforms, since this code is meant to be compiled -- on several platforms. if Integer (Sig) <= Integer (SIID'Last) then if SI.Is_Reserved (SIID (Sig)) and then (Sig /= SIGKILL and Sig /= SIGSTOP) then Reserved_Signal (Sig) := True; end if; else Reserved_Signal (Sig) := True; end if; pragma Warnings (On); end loop; end POSIX.Signals; florist-gpl-2017-src/libsrc/threads/posix-condition_variables.adb0000644000076700001450000002072513106553473024562 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . C O N D I T I O N _ V A R I A B L E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation; with Unchecked_Deallocation; package body POSIX.Condition_Variables is use POSIX.C; use POSIX.Implementation; procedure Free is new Unchecked_Deallocation (pthread_condattr_t, Attributes_Descriptor); procedure Free is new Unchecked_Deallocation (pthread_cond_t, Condition_Descriptor); ---------------- -- Initialize -- ---------------- procedure Initialize (Attr : in out Attributes) is function pthread_condattr_init (attr : access pthread_condattr_t) return int; pragma Import (C, pthread_condattr_init, pthread_condattr_init_LINKNAME); begin Attr.Attr := new pthread_condattr_t; Check_NZ (pthread_condattr_init (Attr.Attr)); end Initialize; -------------- -- Finalize -- -------------- procedure Finalize (Attr : in out Attributes) is function pthread_condattr_destroy (attr : access pthread_condattr_t) return int; pragma Import (C, pthread_condattr_destroy, pthread_condattr_destroy_LINKNAME); begin Check_NZ (pthread_condattr_destroy (Attr.Attr)); Free (Attr.Attr); end Finalize; ------------------------ -- Get_Process_Shared -- ------------------------ function Get_Process_Shared (Attr : Attributes) return Boolean is Result : aliased int; function pthread_condattr_getpshared (attr : Attributes_Descriptor; pshared : access int) return int; pragma Import (C, pthread_condattr_getpshared, pthread_condattr_getpshared_LINKNAME); begin Check_NZ (pthread_condattr_getpshared (Attr.Attr, Result'Unchecked_Access)); return Result = PTHREAD_PROCESS_SHARED; end Get_Process_Shared; ------------------------ -- Set_Process_Shared -- ------------------------ To_pshared : constant array (Boolean) of int := (True => PTHREAD_PROCESS_SHARED, False => PTHREAD_PROCESS_PRIVATE); procedure Set_Process_Shared (Attr : in out Attributes; Is_Shared : Boolean := False) is function pthread_condattr_setpshared (attr : access pthread_condattr_t; pshared : C.int) return int; pragma Import (C, pthread_condattr_setpshared, pthread_condattr_setpshared_LINKNAME); begin Check_NZ (pthread_condattr_setpshared (Attr.Attr, To_pshared (Is_Shared))); end Set_Process_Shared; ---------------- -- Initialize -- ---------------- function pthread_cond_init (cond : access pthread_cond_t; attr : Attributes_Descriptor) return int; pragma Import (C, pthread_cond_init, pthread_cond_init_LINKNAME); procedure Initialize (Cond : in out Condition; Attr : Attributes) is begin Cond.Cond := new pthread_cond_t; Check_NZ (pthread_cond_init (Cond.Cond, Attr.Attr)); end Initialize; procedure Initialize (Cond : in out Condition) is begin Cond.Cond := new pthread_cond_t; Check_NZ (pthread_cond_init (Cond.Cond, null)); end Initialize; ------------------- -- Descriptor_Of -- ------------------- function Descriptor_Of (Cond : Condition) return Condition_Descriptor is begin return Cond.Cond; end Descriptor_Of; -------------- -- Finalize -- -------------- function pthread_cond_destroy (cond : access pthread_cond_t) return int; pragma Import (C, pthread_cond_destroy, pthread_cond_destroy_LINKNAME); procedure Finalize (Cond : in out Condition) is begin Check_NZ (pthread_cond_destroy (Cond.Cond)); Free (Cond.Cond); end Finalize; ------------ -- Signal -- ------------ procedure Signal (Cond : Condition_Descriptor) is function pthread_cond_signal (cond : Condition_Descriptor) return int; pragma Import (C, pthread_cond_signal, pthread_cond_signal_LINKNAME); begin Check_NZ (pthread_cond_signal (Cond)); end Signal; --------------- -- Broadcast -- --------------- procedure Broadcast (Cond : Condition_Descriptor) is function pthread_cond_broadcast (cond : Condition_Descriptor) return int; pragma Import (C, pthread_cond_broadcast, pthread_cond_broadcast_LINKNAME); begin Check_NZ (pthread_cond_broadcast (Cond)); end Broadcast; ---------- -- Wait -- ---------- procedure Wait (Cond : Condition_Descriptor; M : POSIX.Mutexes.Mutex_Descriptor) is function pthread_cond_wait (cond : Condition_Descriptor; mutex : POSIX.Mutexes.Mutex_Descriptor) return int; pragma Import (C, pthread_cond_wait, pthread_cond_wait_LINKNAME); begin Check_NZ (pthread_cond_wait (Cond, M)); end Wait; ---------------- -- Timed_Wait -- ---------------- -- .....change POSIX.5b?????? -- When we tested this operation we found that people tended to -- use it incorrectly, not expecting to get an exception if it times -- out. Perhaps there should be an alternate binding closer to the -- C-language pthread_cond_timedwait, which does not treat ETIME as -- at true error. procedure Timed_Wait (Cond : Condition_Descriptor; M : POSIX.Mutexes.Mutex_Descriptor; Timeout : POSIX.Timespec) is function pthread_cond_timedwait (cond : Condition_Descriptor; mutex : POSIX.Mutexes.Mutex_Descriptor; abstime : access struct_timespec) return int; pragma Import (C, pthread_cond_timedwait, pthread_cond_timedwait_LINKNAME); T : aliased struct_timespec := To_Struct_Timespec (Timeout); begin Check_NZ (pthread_cond_timedwait (Cond, M, T'Unchecked_Access)); end Timed_Wait; end POSIX.Condition_Variables; florist-gpl-2017-src/libsrc/threads/posix_message_queues.ads0000644000076700001450000000570313106553473023661 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ M E S S A G E _ Q U E U E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 1991-1994 Florida State University -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Message_Queues; package POSIX_Message_Queues renames POSIX.Message_Queues; florist-gpl-2017-src/libsrc/threads/posix-process_primitives.adb0000644000076700001450000007155613106553473024505 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P R O C E S S _ P R I M I T I V E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation, POSIX.Unsafe_Process_Primitives, Unchecked_Conversion, Unchecked_Deallocation; package body POSIX.Process_Primitives is use POSIX.C, POSIX.Implementation, POSIX.Process_Identification, POSIX.Process_Environment; C_File_Mode : constant array (POSIX.IO.File_Mode) of Bits := (POSIX.IO.Read_Only => O_RDONLY, POSIX.IO.Write_Only => O_WRONLY, POSIX.IO.Read_Write => O_RDWR); ----------------------------- -- Unchecked Conversions -- ----------------------------- function To_int is new Unchecked_Conversion (Bits, int); function To_String_List_Ptr is new Unchecked_Conversion (POSIX_String_List, String_List_Ptr); function To_String_List_Ptr is new Unchecked_Conversion (POSIX.Process_Environment.Environment, String_List_Ptr); function To_Process_ID is new Unchecked_Conversion (pid_t, Process_ID); function To_pid_t is new Unchecked_Conversion (Process_Group_ID, pid_t); function To_pid_t is new Unchecked_Conversion (Process_ID, pid_t); procedure Free is new Unchecked_Deallocation (FD_Set_Element, FD_Set_Ptr); ------------------------- -- Local Subprograms -- ------------------------- function Make_Path_Name (Directory : POSIX_String; File : POSIX_String) return POSIX_String; pragma Inline (Make_Path_Name); -- Concatenate a directory name and a file name. function Make_Path_Name (Directory : POSIX_String; File : POSIX_String) return POSIX_String is begin if Directory = "" then return File & NUL; end if; if Directory (Directory'Last) = '/' then return Directory & File & NUL; end if; return Directory & '/' & File & NUL; end Make_Path_Name; procedure Delete_Head (Pointer : in out FD_Set_Ptr); procedure Delete_Head (Pointer : in out FD_Set_Ptr) is Head : FD_Set_Ptr := Pointer; begin Pointer := Head.Next; Free (Head); end Delete_Head; procedure Execute_Template (Template : Process_Template); procedure Void (Ignore : int); pragma Inline (Void); procedure Void (Ignore : int) is pragma Unreferenced (Ignore); begin null; end Void; function sigemptyset (set : sigset_t_ptr) return int; pragma Import (C, sigemptyset, sigemptyset_LINKNAME); function sigaddset (set : sigset_t_ptr; sig : POSIX.Signals.Signal) return int; pragma Import (C, sigaddset, sigaddset_LINKNAME); function pthread_sigmask (how : int; set : sigset_t_ptr; oset : sigset_t_ptr) return int; pragma Import (C, pthread_sigmask, pthread_sigmask_LINKNAME); procedure Check_Fatal (Result : int); -- See comments in Execute_Template, below. procedure Check_Fatal (Result : int) is begin if Result = -1 then Exit_Process (Failed_Creation_Exit); end if; end Check_Fatal; function getuid return uid_t; pragma Import (C, getuid, getuid_LINKNAME); function setuid (uid : uid_t) return int; pragma Import (C, setuid, setuid_LINKNAME); function getgid return gid_t; pragma Import (C, getgid, getgid_LINKNAME); function setgid (gid : gid_t) return int; pragma Import (C, setgid, setgid_LINKNAME); function close (fildes : int) return int; pragma Import (C, close, close_LINKNAME); function open (path : char_ptr; oflag : int) return int; pragma Import (C, open, open_LINKNAME); function dup2 (fildes, fildes2 : int) return int; pragma Import (C, dup2, dup2_LINKNAME); procedure Execute_Template (Template : Process_Template) is FD1, FD2 : int; Cur : FD_Set_Ptr := Template.FD_Set; New_Mask, Old_Mask : aliased sigset_t; begin if not Template.Keep_Effective_IDs then -- See note below why we do not call operations from -- POSIX_Process_Identification, since they may raise -- exceptions, and we worry about our ability to handle -- them. Check_Fatal (setuid (getuid)); Check_Fatal (setgid (getgid)); end if; -- We cannot use signal masking operations from -- POSIX.Signals, since they are implemented as -- virtual operations, relative to the Ada task's -- view of the signal interface. We normally keep -- most signals masked in all tasks except the designated -- signal handler threads, so that we can safely use -- sigwait. During this situation, we have just forked -- and we hope|expect there are no other threads active -- in the new (child) process. Under these conditions -- (only) it should be safe to use the raw signal masking -- operations. In earlier versions, we used the almost-raw -- versions, from System.Interrupt_Management.Operations. -- These had the advantage that the Ada RTS has already -- taken care of mapping to any nonstandard functions, -- such as the Solaris 2.x thr_sigmask, versus the -- POSIX.1c pthread_sigmask. However, more recent versions -- of Unix operating systems do support the standard, -- and in posi-signals.gpb we have already used some of -- the raw C interfaces. In the current version, we have -- gone over to completely avoiding calls to the Ada tasking -- runtime system. -- If an exception is raised during this time, the tasking -- runtime system's data structures may "lie" about there -- being other tasks active. This could prevent -- orderly shutdown of the process. Hence, we use -- Check_Fatal instead of the usual Check, and generally -- try to avoid calling anything that could raise an -- exception. -- .... ???? -- The code below may not be robust against exceptions -- that occur between fork and exec calls. There may be -- a possibility of deadlock, if the fork occurred while some -- other task is holding an RTS-internal lock that we need to -- process exceptions. -- The present approach is to avoid exceptions, by calling the -- "raw" C interfaces below, and to replace the soft-links that are -- used to set up exception-handling frames to use the nontasking -- versions, since we may not be able to avoid those routines being -- called. The soft links are switched inside the version of Fork -- that we import from POSIX.Unsafe_Process_Primitives. while Cur /= null loop case Cur.Action is when Close => Check_Fatal (close (int (Cur.FD))); when Open => FD1 := open (Cur.File_Name (Cur.File_Name'First)'Unchecked_Access, To_int (Option_Set (Cur.File_Options).Option or C_File_Mode (Cur.File_Mode))); if FD1 = -1 then Exit_Process (Failed_Creation_Exit); end if; -- FD2 := dup2 (FD1, int (Cur.FD)); should be enough for the -- following if/else statement. However, we have a mulfunction -- under Linux when the two arguments are the same. The following -- code is a workaround. if FD1 /= int (Cur.FD) then FD2 := dup2 (FD1, int (Cur.FD)); else FD2 := FD1; end if; if FD2 = -1 then Exit_Process (Failed_Creation_Exit); end if; when Duplicate => FD2 := dup2 (int (Cur.Dup_From), int (Cur.FD)); if FD2 = -1 then Exit_Process (Failed_Creation_Exit); end if; end case; Cur := Cur.Next; end loop; Void (sigemptyset (New_Mask'Unchecked_Access)); for Sig in 1 .. POSIX.Signals.Signal'Last loop if POSIX.Signals.Is_Member (Template.Sig_Set, Sig) then Void (sigaddset (New_Mask'Unchecked_Access, Sig)); end if; end loop; Void (pthread_sigmask (SIG_SETMASK, New_Mask'Unchecked_Access, Old_Mask'Unchecked_Access)); -- ???? is pthread_sigmask OK after a fork? -- sigprocmask is not safe in a multithreaded process, but after -- the fork() call we are effectively in a single-threaded process, -- so it might be better to use sigprocmask? -- Void (sigprocmask (SIG_SETMASK, New_Mask'Unchecked_Access, null)); exception when others => Exit_Process (Failed_Creation_Exit); -- Since this may not work, we have tried to avoid raising -- any exceptions. However, in case we have missed something -- and an exception is raised, we leave the handler here, -- on the off-chance it might work. end Execute_Template; procedure Validate (Template : Process_Template); procedure Validate (Template : Process_Template) is begin if Template.Is_Closed then Raise_POSIX_Error (Invalid_Argument); end if; end Validate; --------------------- -- Open_Template -- --------------------- procedure Open_Template (Template : in out Process_Template) is begin Template.Is_Closed := False; Template.Keep_Effective_IDs := False; Template.Masked_Sig := No_Signals; Template.FD_Set := null; end Open_Template; ---------------------- -- Close_Template -- ---------------------- procedure Close_Template (Template : in out Process_Template) is begin Validate (Template); while Template.FD_Set /= null loop Delete_Head (Template.FD_Set); end loop; Template.Is_Closed := True; end Close_Template; ------------------------------ -- Set_Keep_Effective_IDs -- ------------------------------ procedure Set_Keep_Effective_IDs (Template : in out Process_Template) is begin Validate (Template); Template.Keep_Effective_IDs := True; end Set_Keep_Effective_IDs; ----------------------- -- Set_Signal_Mask -- ----------------------- procedure Set_Signal_Mask (Template : in out Process_Template; Mask : POSIX.Signals.Signal_Set) is begin Validate (Template); Template.Sig_Set := Mask; end Set_Signal_Mask; ----------------------------------- -- Set_Creation_Signal_Masking -- ----------------------------------- procedure Set_Creation_Signal_Masking (Template : in out Process_Template; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) is begin Validate (Template); Template.Masked_Sig := Masked_Signals; end Set_Creation_Signal_Masking; -------------------------------- -- Set_File_Action_To_Close -- -------------------------------- procedure Set_File_Action_To_Close (Template : in out Process_Template; File : POSIX.IO.File_Descriptor) is Tmp : FD_Set_Ptr := Template.FD_Set; begin Validate (Template); if Tmp = null then Template.FD_Set := new FD_Set_Element (Close, 1); Tmp := Template.FD_Set; else while Tmp.Next /= null loop Tmp := Tmp.Next; end loop; Tmp.Next := new FD_Set_Element (Close, 1); Tmp := Tmp.Next; end if; Tmp.FD := File; Tmp.Next := null; Tmp.Action := Close; end Set_File_Action_To_Close; ------------------------------- -- Set_File_Action_To_Open -- ------------------------------- procedure Set_File_Action_To_Open (Template : in out Process_Template; File : POSIX.IO.File_Descriptor; Name : POSIX.Pathname; Mode : POSIX.IO.File_Mode := POSIX.IO.Read_Only; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set) is Name_With_NUL : constant POSIX_String := Name & NUL; Tmp : FD_Set_Ptr := Template.FD_Set; begin Validate (Template); if Tmp = null then Template.FD_Set := new FD_Set_Element (Open, Name_With_NUL'Length); Tmp := Template.FD_Set; else while Tmp.Next /= null loop Tmp := Tmp.Next; end loop; Tmp.Next := new FD_Set_Element (Open, Name_With_NUL'Length); Tmp := Tmp.Next; end if; Tmp.FD := File; Tmp.Next := null; Tmp.Action := Open; Tmp.File_Name := Name_With_NUL; Tmp.File_Mode := Mode; Tmp.File_Options := Options; end Set_File_Action_To_Open; ------------------------------------ -- Set_File_Action_To_Duplicate -- ------------------------------------ procedure Set_File_Action_To_Duplicate (Template : in out Process_Template; File : POSIX.IO.File_Descriptor; From_File : POSIX.IO.File_Descriptor) is Tmp : FD_Set_Ptr := Template.FD_Set; begin Validate (Template); if Tmp = null then Template.FD_Set := new FD_Set_Element (Duplicate, 1); Tmp := Template.FD_Set; else while Tmp.Next /= null loop Tmp := Tmp.Next; end loop; Tmp.Next := new FD_Set_Element (Duplicate, 1); Tmp := Tmp.Next; end if; Tmp.FD := File; Tmp.Next := null; Tmp.Action := Duplicate; Tmp.Dup_From := From_File; end Set_File_Action_To_Duplicate; --------------------- -- Start_Process -- --------------------- function execv (path : char_ptr; argv : char_ptr_ptr) return int; pragma Import (C, execv, execv_LINKNAME); function execve (path : char_ptr; argv : char_ptr_ptr; envp : char_ptr_ptr) return int; pragma Import (C, execve, execve_LINKNAME); function execvp (file : char_ptr; argv : char_ptr_ptr) return int; pragma Import (C, execvp, execvp_LINKNAME); function UFork return POSIX.Process_Identification.Process_ID renames POSIX.Unsafe_Process_Primitives.Fork; procedure Start_Process (Child : out POSIX.Process_Identification.Process_ID; Pathname : POSIX.Pathname; Template : Process_Template; Arg_List : POSIX_String_List := Empty_String_List) is pid : pid_t; Result : int; pragma Unreferenced (Result); Pathname_With_NUL : POSIX_String := Pathname & NUL; Arg : String_List_Ptr := To_String_List_Ptr (Arg_List); Default_Arg : POSIX_String_List; Old_Mask : aliased Signal_Mask; begin -- Construct a default argument list with the executable name (argv[0]) if Arg_List = null or else Length (Arg_List) = 0 then Append (Default_Arg, Pathname_With_NUL); Arg := To_String_List_Ptr (Default_Arg); end if; Validate (Template); -- .... Consider trying to "quiesce" the tasking system -- before doing the fork. It is probably not feasible. Mask_Signals (Template.Masked_Sig, Old_Mask'Unchecked_Access); pid := To_pid_t (UFork); Check (int (pid)); if pid = 0 then -- child process Execute_Template (Template); Result := execv (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, Arg.Char (1)'Unchecked_Access); Exit_Process (Failed_Creation_Exit); else Child := To_Process_ID (pid); Make_Empty (Default_Arg); Restore_Signals (Template.Masked_Sig, Old_Mask'Unchecked_Access); end if; end Start_Process; procedure Start_Process (Child : out POSIX.Process_Identification.Process_ID; Pathname : POSIX.Pathname; Template : Process_Template; Env_List : POSIX.Process_Environment.Environment; Arg_List : POSIX_String_List := Empty_String_List) is pid : pid_t; Result : int; pragma Unreferenced (Result); Pathname_With_NUL : POSIX_String := Pathname & NUL; Arg : String_List_Ptr := To_String_List_Ptr (Arg_List); Env : String_List_Ptr := To_String_List_Ptr (Env_List); begin if Arg = null then Arg := Null_String_List_Ptr; end if; if Env = null then Env := Null_String_List_Ptr; end if; Validate (Template); pid := To_pid_t (UFork); Check (int (pid)); if pid = 0 then -- child process Execute_Template (Template); Result := execve (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, Arg.Char (1)'Access, Env.Char (1)'Access); Exit_Process (Failed_Creation_Exit); else Child := To_Process_ID (pid); end if; end Start_Process; ---------------------------- -- Start_Process_Search -- ---------------------------- procedure Start_Process_Search (Child : out POSIX.Process_Identification.Process_ID; Filename : POSIX.Filename; Template : Process_Template; Arg_List : POSIX_String_List := Empty_String_List) is pid : pid_t; Result : int; pragma Unreferenced (Result); Filename_With_NUL : POSIX_String := Filename & NUL; Arg : String_List_Ptr := To_String_List_Ptr (Arg_List); begin if Arg = null then Arg := Null_String_List_Ptr; end if; Validate (Template); pid := To_pid_t (UFork); Check (int (pid)); if pid = 0 then -- child process Execute_Template (Template); Result := execvp (Filename_With_NUL (Filename_With_NUL'First)'Unchecked_Access, Arg.Char (1)'Access); Exit_Process (Failed_Creation_Exit); else Child := To_Process_ID (pid); end if; end Start_Process_Search; ---------------------------- -- Start_Process_Search -- ---------------------------- procedure Start_Process_Search (Child : out POSIX.Process_Identification.Process_ID; Filename : POSIX.Filename; Template : Process_Template; Env_List : POSIX.Process_Environment.Environment; Arg_List : POSIX_String_List := Empty_String_List) is pid : pid_t; Filename_With_NUL : POSIX_String := Filename & NUL; Arg : String_List_Ptr := To_String_List_Ptr (Arg_List); Env : String_List_Ptr := To_String_List_Ptr (Env_List); begin if Arg = null then Arg := Null_String_List_Ptr; end if; if Env = null then Env := Null_String_List_Ptr; end if; Validate (Template); pid := To_pid_t (UFork); Check (int (pid)); if pid = 0 then -- child process Execute_Template (Template); -- See comments in POSIX.Unsafe_Process_Primitives.Exec_Search. -- We duplicate the code here, since we don't want to raise -- any exceptions in the child process. for I in Filename'Range loop if Filename (I) = '/' then Check_Fatal (execve (Filename_With_NUL (Filename_With_NUL'First)'Unchecked_Access, Arg.Char (1)'Access, Env.Char (1)'Access)); return; end if; end loop; -- filename does not contain "/" declare Path : constant POSIX_String := POSIX.Process_Environment.Environment_Value_Of ("PATH", "/bin:/usr/bin"); Start : Positive; P : Positive; Result : int; pragma Unreferenced (Result); begin P := Path'First; loop Start := P; while P <= Path'Last and then Path (P) /= ':' loop P := P + 1; end loop; declare Pathname : POSIX_String := Make_Path_Name (Path (Start .. P - 1), Filename); begin Result := execve (Pathname (Pathname'First)'Unchecked_Access, Arg.Char (1)'Access, Env.Char (1)'Access); if Fetch_Errno /= ENOENT then Exit_Process (Failed_Creation_Exit); end if; end; exit when P > Path'Last; P := P + 1; -- skip colon end loop; end; Exit_Process (Failed_Creation_Exit); else Child := To_Process_ID (pid); end if; end Start_Process_Search; -------------------- -- Exit_Process -- -------------------- procedure sys_exit (status : int); pragma Import (C, sys_exit, "_exit"); procedure Exit_Process (Status : Exit_Status := Normal_Exit) is begin sys_exit (int (Status)); end Exit_Process; ------------------------ -- Status_Available -- ------------------------ function Status_Available (Status : Termination_Status) return Boolean is begin return Status.pid /= 0 and Status.pid /= -1; end Status_Available; --------------------- -- Process_ID_Of -- --------------------- function Process_ID_Of (Status : Termination_Status) return POSIX.Process_Identification.Process_ID is begin if not Status_Available (Status) then Raise_POSIX_Error (Invalid_Argument); end if; return To_Process_ID (Status.pid); end Process_ID_Of; ---------------------- -- Exit_Status_Of -- ---------------------- function wifexited (stat_val : int) return int; pragma Import (C, wifexited, "wifexited"); function wexitstatus (stat_val : int) return int; pragma Import (C, wexitstatus, "wexitstatus"); function Exit_Status_Of (Status : Termination_Status) return Exit_Status is begin if not Status_Available (Status) or else wifexited (Status.stat_val) = 0 then Raise_POSIX_Error (Invalid_Argument); end if; return Exit_Status (wexitstatus (Status.stat_val)); end Exit_Status_Of; ----------------------------- -- Termination_Signal_Of -- ----------------------------- function wifsignaled (stat_val : int) return int; pragma Import (C, wifsignaled, "wifsignaled"); function wtermsig (stat_val : int) return int; pragma Import (C, wtermsig, "wtermsig"); function Termination_Signal_Of (Status : Termination_Status) return POSIX.Signals.Signal is begin if not Status_Available (Status) or else wifsignaled (Status.stat_val) = 0 then Raise_POSIX_Error (Invalid_Argument); end if; return POSIX.Signals.Signal (wtermsig (Status.stat_val)); end Termination_Signal_Of; -------------------------- -- Stopping_Signal_Of -- -------------------------- function wifstopped (stat_val : int) return int; pragma Import (C, wifstopped, "wifstopped"); function wstopsig (stat_val : int) return int; pragma Import (C, wstopsig, "wstopsig"); function Stopping_Signal_Of (Status : Termination_Status) return POSIX.Signals.Signal is begin if not Status_Available (Status) or else wifstopped (Status.stat_val) = 0 then Raise_POSIX_Error (Invalid_Argument); end if; return POSIX.Signals.Signal (wstopsig (Status.stat_val)); end Stopping_Signal_Of; ---------------------------- -- Termination_Cause_Of -- ---------------------------- function Termination_Cause_Of (Status : Termination_Status) return Termination_Cause is begin if not Status_Available (Status) then Raise_POSIX_Error (Invalid_Argument); end if; if wifexited (Status.stat_val) /= 0 then return Exited; end if; if wifsignaled (Status.stat_val) /= 0 then return Terminated_By_Signal; end if; if wifstopped (Status.stat_val) /= 0 then return Stopped_By_Signal; end if; -- should never get here, unles system is broken -- .... so we punt Raise_POSIX_Error (ENOSYS); return Stopped_By_Signal; -- to suppress compiler warning; end Termination_Cause_Of; ------------------------------ -- Wait_For_Child_Process -- ------------------------------ function waitpid (pid : pid_t; stat_loc : access int; options : int) return pid_t; pragma Import (C, waitpid, waitpid_LINKNAME); procedure Wait_For_Child_Process (Status : out Termination_Status; Child : POSIX.Process_Identification.Process_ID; Block : Boolean := True; Trace_Stopped : Boolean := True; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) is pragma Unreferenced (Masked_Signals); Options : Bits := 0; begin if Trace_Stopped then Options := Options or WUNTRACED; end if; if not Block then Options := Options or WNOHANG; end if; Defer_Abortion; -- .... Change P1003.5? -- We ignore the signal masking parameter, since we keep -- most signals masked all the time except in the special -- handler threads. Thus, effectively, this operation -- cannot be interrupted, except by somebody asynchronously -- sending the thread or process one of the signals that -- are: mapped to exceptions (e.g. SIGSEGV); used by the -- threads library (which we dare not mask); or used for -- Ada abortion (e.g. SIGABRT). We think it is unsafe to -- mask these, and so intentionally do not implement the -- exact POSIX.5 semantics here. Status.pid := waitpid (To_pid_t (Child), Status.stat_val'Unchecked_Access, To_int (Options)); Undefer_Abortion; Check (int (Status.pid)); end Wait_For_Child_Process; ------------------------------ -- Wait_For_Child_Process -- ------------------------------ procedure Wait_For_Child_Process (Status : out Termination_Status; Group : POSIX.Process_Identification.Process_Group_ID; Block : Boolean := True; Trace_Stopped : Boolean := True; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) is begin Wait_For_Child_Process (Status, To_Process_ID (-To_pid_t (Group)), Block, Trace_Stopped, Masked_Signals); end Wait_For_Child_Process; ------------------------------ -- Wait_For_Child_Process -- ------------------------------ procedure Wait_For_Child_Process (Status : out Termination_Status; Block : Boolean := True; Trace_Stopped : Boolean := True; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) is begin Wait_For_Child_Process (Status, To_Process_ID (-1), Block, Trace_Stopped, Masked_Signals); end Wait_For_Child_Process; end POSIX.Process_Primitives; florist-gpl-2017-src/libsrc/threads/posix-condition_variables.ads0000644000076700001450000001112513106553473024575 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . C O N D I T I O N _ V A R I A B L E S -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.Mutexes; package POSIX.Condition_Variables is -- ========== -- -- WARNINGS -- -- ========== -- -- This package is for mixed-language programming, in which -- an Ada task needs to synchronize with a C thread. -- Do NOT use POSIX CVs to synchronize between Ada tasks. -- Instead, use Ada protected objects. -- If you use one of these "raw" CVs, you risk undefined -- behavior if you violate any of the POSIX.1c rules about CVs, -- or if you attempt to abort (including ATC) a task that is performing -- a mutex or CV operation. type Condition is limited private; type Condition_Descriptor is private; type Attributes is private; procedure Initialize (Attr : in out Attributes); procedure Finalize (Attr : in out Attributes); function Get_Process_Shared (Attr : Attributes) return Boolean; procedure Set_Process_Shared (Attr : in out Attributes; Is_Shared : Boolean := False); procedure Initialize (Cond : in out Condition; Attr : Attributes); procedure Initialize (Cond : in out Condition); function Descriptor_Of (Cond : Condition) return Condition_Descriptor; procedure Finalize (Cond : in out Condition); procedure Signal (Cond : Condition_Descriptor); procedure Broadcast (Cond : Condition_Descriptor); procedure Wait (Cond : Condition_Descriptor; M : POSIX.Mutexes.Mutex_Descriptor); procedure Timed_Wait (Cond : Condition_Descriptor; M : POSIX.Mutexes.Mutex_Descriptor; Timeout : POSIX.Timespec); private type Condition_Descriptor is access POSIX.C.pthread_cond_t; type Attributes_Descriptor is access POSIX.C.pthread_condattr_t; type Attributes is record Attr : Attributes_Descriptor; end record; type Condition is record Cond : Condition_Descriptor; end record; end POSIX.Condition_Variables; florist-gpl-2017-src/libsrc/threads/posix-timers.ads0000644000076700001450000001141313106553473022062 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . T I M E R S -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.Signals; package POSIX.Timers is type Clock_ID is private; type Timer_ID is private; Clock_Realtime : constant Clock_ID; type Timer_State is private; type Timer_Options is new POSIX.Option_Set; Absolute_Timer : constant Timer_Options; procedure Set_Initial (State : in out Timer_State; Initial : POSIX.Timespec); function Get_Initial (State : Timer_State) return POSIX.Timespec; procedure Set_Interval (State : in out Timer_State; Interval : POSIX.Timespec); function Get_Interval (State : Timer_State) return POSIX.Timespec; procedure Set_Time (Clock : Clock_ID; Value : POSIX.Timespec); procedure Set_Time (Value : POSIX.Timespec); function Get_Time (Clock : Clock_ID := Clock_Realtime) return POSIX.Timespec; function Get_Resolution (Clock : Clock_ID := Clock_Realtime) return POSIX.Timespec; function Create_Timer (Clock : Clock_ID; Event : POSIX.Signals.Signal_Event) return Timer_ID; procedure Delete_Timer (Timer : in out Timer_ID); procedure Arm_Timer (Timer : Timer_ID; Options : Timer_Options; New_State : Timer_State; Old_State : out Timer_State); procedure Arm_Timer (Timer : Timer_ID; Options : Timer_Options; New_State : Timer_State); function Get_Timer_State (Timer : Timer_ID) return Timer_State; procedure Disarm_Timer (Timer : Timer_ID); function Get_Timer_Overruns (Timer : Timer_ID) return Natural; private type Clock_ID is new POSIX.C.clockid_t; Clock_Realtime : constant Clock_ID := POSIX.C.CLOCK_REALTIME; type Timer_ID is new POSIX.C.timer_t; -- We add a tag to force by-reference parameter passing. -- This allows us to pass through to the C interface pointers -- directly to the argument, thereby saving copying. type Timer_State is tagged record State : aliased POSIX.C.struct_itimerspec; end record; Absolute_Timer : constant Timer_Options := Timer_Options (Option_Set'(Option => POSIX.C.TIMER_ABSTIME)); end POSIX.Timers; florist-gpl-2017-src/libsrc/threads/posix-asynchronous_io.adb0000644000076700001450000004342013106553473023763 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . A S Y N C H R O N O U S _ I O -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with Ada.Streams, System, POSIX.Implementation, Unchecked_Conversion, Unchecked_Deallocation; package body POSIX.Asynchronous_IO is use Ada.Streams, POSIX.C, POSIX.Implementation; --------------------------------- -- Create_AIO_Control_Block -- --------------------------------- function Create_AIO_Control_Block return AIO_Descriptor is begin return new Aiocb_Wrapper; end Create_AIO_Control_Block; --------------------------------- -- Destroy_AIO_Control_Block -- --------------------------------- function aio_error (AD : AIO_Descriptor) return Error_Code; pragma Import (C, aio_error, aio_error_LINKNAME); procedure Free is new Unchecked_Deallocation (Aiocb_Wrapper, AIO_Descriptor); -- ????? Change POSIX.5b? -- This operation is very difficult to use correctly, since -- it is not idempotent. That is, if there is an exception and -- we want to clean up after it, we cannot safely call Destroy_... -- since we don't know whether the AIO_Descriptor is valid. procedure Destroy_AIO_Control_Block (AD : in out AIO_Descriptor) is begin Check (AD /= null, Invalid_Argument); if aio_error (AD) = EINPROGRESS then Raise_POSIX_Error (Operation_Not_Permitted); end if; Free (AD); end Destroy_AIO_Control_Block; ---------------- -- Get_File -- ---------------- function Get_File (AD : AIO_Descriptor) return POSIX.IO.File_Descriptor is begin Check (AD /= null, Invalid_Argument); return POSIX.IO.File_Descriptor (AD.C.aio_fildes); end Get_File; ---------------- -- Set_File -- ---------------- procedure Set_File (AD : AIO_Descriptor; File : POSIX.IO.File_Descriptor) is begin Check (AD /= null, Invalid_Argument); AD.C.aio_fildes := int (File); end Set_File; ------------------ -- Get_Offset -- ------------------ function Get_Offset (AD : AIO_Descriptor) return POSIX.IO.IO_Offset is begin Check (AD /= null, Invalid_Argument); return POSIX.IO.IO_Offset (AD.C.aio_offset); end Get_Offset; ------------------ -- Set_Offset -- ------------------ procedure Set_Offset (AD : AIO_Descriptor; Offset : POSIX.IO.IO_Offset) is begin Check (AD /= null, Invalid_Argument); AD.C.aio_offset := off_t (Offset); end Set_Offset; ------------------ -- Get_Buffer -- ------------------ -- .... Change POSIX.5? -- The component aio_buf is of type volatile void * in C -- The Ada buffer should also be required to be declared volatile. function Get_Buffer (AD : AIO_Descriptor) return IO_Array_Pointer is begin Check (AD /= null, Invalid_Argument); return AD.P; end Get_Buffer; ------------------ -- Set_Buffer -- ------------------ procedure Set_Buffer (AD : AIO_Descriptor; Buffer : IO_Array_Pointer) is begin Check (AD /= null, Invalid_Argument); AD.C.aio_nbytes := Buffer'Length; AD.C.aio_buf := Buffer (Buffer'First)'Address; AD.P := Buffer; end Set_Buffer; ------------------ -- Get_Length -- ------------------ function Get_Length (AD : AIO_Descriptor) return IO_Count is begin Check (AD /= null, Invalid_Argument); return IO_Count (AD.C.aio_nbytes); end Get_Length; ------------------ -- Set_Length -- ------------------ procedure Set_Length (AD : AIO_Descriptor; Length : IO_Count) is begin Check (AD /= null, Invalid_Argument); AD.C.aio_nbytes := size_t (Length); end Set_Length; ------------------------------ -- Get_Priority_Reduction -- ------------------------------ function Get_Priority_Reduction (AD : AIO_Descriptor) return Natural is begin Check (AD /= null, Invalid_Argument); return Natural (AD.C.aio_reqprio); end Get_Priority_Reduction; ------------------------------ -- Set_Priority_Reduction -- ------------------------------ procedure Set_Priority_Reduction (AD : AIO_Descriptor; Priority_Reduction : Natural) is begin Check (AD /= null, Invalid_Argument); AD.C.aio_reqprio := int (Priority_Reduction); end Set_Priority_Reduction; ----------------- -- Get_Event -- ----------------- function To_Signal_Event is new Unchecked_Conversion (struct_sigevent, POSIX.Signals.Signal_Event); function Get_Event (AD : AIO_Descriptor) return POSIX.Signals.Signal_Event is begin Check (AD /= null, Invalid_Argument); return To_Signal_Event (AD.C.aio_sigevent); end Get_Event; ----------------- -- Set_Event -- ----------------- function To_struct_sigevent is new Unchecked_Conversion (POSIX.Signals.Signal_Event, struct_sigevent); procedure Set_Event (AD : AIO_Descriptor; Event : POSIX.Signals.Signal_Event) is begin Check (AD /= null, Invalid_Argument); AD.C.aio_sigevent := To_struct_sigevent (Event); end Set_Event; --------------------- -- Get_Operation -- --------------------- function Get_Operation (AD : AIO_Descriptor) return List_IO_Operations is opcode : int; begin Check (AD /= null, Invalid_Argument); opcode := AD.C.aio_lio_opcode; pragma Warnings (Off); -- Disable warning on some platforms where LIO_NOP=LIO_READ=LIO_WRITE=0 if opcode = LIO_NOP then return No_Op; elsif opcode = LIO_READ then return Read; elsif opcode = LIO_WRITE then return Write; end if; pragma Warnings (On); Raise_POSIX_Error (Invalid_Argument); -- to suppress compiler warning message: return No_Op; end Get_Operation; --------------------- -- Set_Operation -- --------------------- C_lio_op : constant array (List_IO_Operations) of int := (No_Op => LIO_NOP, Read => LIO_READ, Write => LIO_WRITE); procedure Set_Operation (AD : AIO_Descriptor; Operation : List_IO_Operations) is begin Check (AD /= null, Invalid_Argument); AD.C.aio_lio_opcode := C_lio_op (Operation); end Set_Operation; ------------ -- Read -- ------------ procedure Read (AD : AIO_Descriptor) is function aio_read (AD : AIO_Descriptor) return int; pragma Import (C, aio_read, aio_read_LINKNAME); begin Check (AD /= null, Invalid_Argument); Check (aio_read (AD)); end Read; ------------- -- Write -- ------------- procedure Write (AD : AIO_Descriptor) is function aio_write (AD : AIO_Descriptor) return int; pragma Import (C, aio_write, aio_write_LINKNAME); begin Check (AD /= null, Invalid_Argument); Check (aio_write (AD)); end Write; ----------------------- -- List_IO_No_Wait -- ----------------------- function lio_listio (mode : int; list : access AIO_Descriptor; nent : int; sig : sigevent_ptr) return int; pragma Import (C, lio_listio, lio_listio_LINKNAME); procedure List_IO_No_Wait (List : in out AIO_Descriptor_List; Event : POSIX.Signals.Signal_Event) is sigevent : aliased struct_sigevent := To_struct_sigevent (Event); begin for i in List'Range loop Check (List (i) /= null, Invalid_Argument); end loop; Check (lio_listio (LIO_NOWAIT, List (List'First)'Unchecked_Access, int (List'Length), sigevent'Unchecked_Access)); end List_IO_No_Wait; --------------------- -- List_IO_Wait -- --------------------- procedure List_IO_Wait (List : in out AIO_Descriptor_List; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) is Old_Mask : aliased Signal_Mask; Result : int; begin for i in List'Range loop Check (List (i) /= null, Invalid_Argument); end loop; Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := lio_listio (LIO_WAIT, List (List'First)'Unchecked_Access, int (List'Length), null); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end List_IO_Wait; ---------------------- -- Get_AIO_Status -- ---------------------- function Get_AIO_Status (AD : AIO_Descriptor) return AIO_Status is Result : Error_Code; begin Check (AD /= null, Invalid_Argument); Result := aio_error (AD); if Result = 0 then return Completed_Successfully; elsif Result = EINPROGRESS then return In_Progress; elsif Result = ECANCELED then return Canceled; end if; Raise_POSIX_Error; -- to supress compiler warning message return Canceled; end Get_AIO_Status; -------------------------- -- Get_AIO_Error_Code -- -------------------------- function Get_AIO_Error_Code (AD : AIO_Descriptor) return POSIX.Error_Code is Result : Error_Code; begin Check (AD /= null, Invalid_Argument); Result := aio_error (AD); if Result = ENOSYS or else Result = EINVAL then Raise_POSIX_Error; end if; return Result; end Get_AIO_Error_Code; ------------------------------- -- Get_Bytest_Transferred -- ------------------------------- function Get_Bytes_Transferred (AD : AIO_Descriptor) return IO_Count is function aio_return (AD : AIO_Descriptor) return ssize_t; pragma Import (C, aio_return, aio_return_LINKNAME); Result : ssize_t; begin Check (AD /= null, Invalid_Argument); Result := aio_return (AD); Check (int (Result)); return IO_Count (Result); end Get_Bytes_Transferred; -------------- -- Cancel -- -------------- function aio_cancel (fildes : int; aiocb : AIO_Descriptor) return int; pragma Import (C, aio_cancel, aio_cancel_LINKNAME); function Cancel (AD : AIO_Descriptor) return Cancelation_Status is Result : int; begin Result := aio_cancel (AD.C.aio_fildes, AD); pragma Warnings (Off); -- Disable warning on some platforms where AIO_*=0 if Result = AIO_CANCELED then return Canceled; elsif Result = AIO_NOTCANCELED then return Not_Canceled; elsif Result = AIO_ALLDONE then return All_Done; end if; pragma Warnings (On); Raise_POSIX_Error; -- to suppress compiler warning message return All_Done; end Cancel; function Cancel (File : POSIX.IO.File_Descriptor) return Cancelation_Status is Result : int; begin Result := aio_cancel (int (File), null); pragma Warnings (Off); -- Disable warning on some platforms where AIO_*=0 if Result = AIO_CANCELED then return Canceled; elsif Result = AIO_NOTCANCELED then return Not_Canceled; elsif Result = AIO_ALLDONE then return All_Done; end if; pragma Warnings (On); Raise_POSIX_Error; -- to suppress compiler warning message return All_Done; end Cancel; --------------------------- -- Await_IO_Or_Timeout -- --------------------------- type aiocb_ptr_ptr is access constant AIO_Descriptor; function aio_suspend (list : aiocb_ptr_ptr; nent : int; timeout : timespec_ptr) return int; pragma Import (C, aio_suspend, aio_suspend_LINKNAME); procedure Await_IO_Or_Timeout (AD : AIO_Descriptor; Timeout : POSIX.Timespec; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) is TS : aliased struct_timespec; Old_Mask : aliased Signal_Mask; List : AIO_Descriptor_List (1 .. 1) := (others => AD); Result : int; begin Check (AD /= null, Invalid_Argument); TS := To_Struct_Timespec (To_Duration (Timeout)); Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := aio_suspend (List (List'First)'Unchecked_Access, List'Length, TS'Unchecked_Access); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Await_IO_Or_Timeout; procedure Await_IO_Or_Timeout (List : AIO_Descriptor_List; Timeout : POSIX.Timespec; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) is TS : aliased struct_timespec; Old_Mask : aliased Signal_Mask; Result : int; begin for i in List'Range loop Check (List (i) /= null, Invalid_Argument); end loop; TS := To_Struct_Timespec (To_Duration (Timeout)); Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := aio_suspend (List (List'First)'Unchecked_Access, List'Length, TS'Unchecked_Access); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Await_IO_Or_Timeout; ---------------- -- Await_IO -- ---------------- procedure Await_IO (AD : AIO_Descriptor; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) is Old_Mask : aliased Signal_Mask; List : AIO_Descriptor_List (1 .. 1) := (others => AD); Result : int; begin Check (AD /= null, Invalid_Argument); Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := aio_suspend (List (List'First)'Unchecked_Access, List'Length, null); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Await_IO; procedure Await_IO (List : AIO_Descriptor_List; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) is Old_Mask : aliased Signal_Mask; Result : int; begin for i in List'Range loop if List (i) = null then Raise_POSIX_Error (Invalid_Argument); end if; end loop; Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := aio_suspend (List (List'First)'Unchecked_Access, List'Length, null); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Await_IO; ------------------------ -- Synchronize_File -- ------------------------ function aio_fsync (op : int; AD : AIO_Descriptor) return int; pragma Import (C, aio_fsync, aio_fsync_LINKNAME); procedure Synchronize_File (AD : AIO_Descriptor) is begin Check (AD /= null, Invalid_Argument); Check (aio_fsync (O_SYNC, AD)); end Synchronize_File; ------------------------ -- Synchronize_Data -- ------------------------ procedure Synchronize_Data (AD : AIO_Descriptor) is begin Check (AD /= null, Invalid_Argument); Check (aio_fsync (O_DSYNC, AD)); end Synchronize_Data; begin -- Check that struct aiocb component is allocated in first position, -- so that we can safely convert pointers. declare X : aliased Aiocb_Wrapper; use System; begin if X'Address /= X.C'Address then raise Program_Error; end if; end; end POSIX.Asynchronous_IO; florist-gpl-2017-src/libsrc/threads/posix-mutexes.adb0000644000076700001450000002730213106553473022234 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . M U T E X E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2007, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation; package body POSIX.Mutexes is use POSIX.C; use POSIX.Implementation; type Mutexattr_Descriptor is access constant pthread_mutexattr_t; ------------------ -- Initialize -- ------------------ function pthread_mutexattr_init (attr : access pthread_mutexattr_t) return int; pragma Import (C, pthread_mutexattr_init, pthread_mutexattr_init_LINKNAME); procedure Initialize (Attr : in out Attributes) is begin Check_NZ (pthread_mutexattr_init (Attr.Attr'Unchecked_Access)); end Initialize; ---------------- -- Finalize -- ---------------- function pthread_mutexattr_destroy (attr : access pthread_mutexattr_t) return int; pragma Import (C, pthread_mutexattr_destroy, pthread_mutexattr_destroy_LINKNAME); procedure Finalize (Attr : in out Attributes) is begin Check_NZ (pthread_mutexattr_destroy (Attr.Attr'Unchecked_Access)); end Finalize; -------------------------- -- Get_Process_Shared -- -------------------------- function pthread_mutexattr_getpshared (attr : Mutexattr_Descriptor; pshared : access int) return int; pragma Import (C, pthread_mutexattr_getpshared, pthread_mutexattr_getpshared_LINKNAME); function Get_Process_Shared (Attr : Attributes) return Boolean is Result : aliased int; begin Check_NZ (pthread_mutexattr_getpshared (Attr.Attr'Unchecked_Access, Result'Unchecked_Access)); return Result = PTHREAD_PROCESS_SHARED; end Get_Process_Shared; -------------------------- -- Set_Process_Shared -- -------------------------- function pthread_mutexattr_setpshared (attr : access pthread_mutexattr_t; pshared : int) return int; pragma Import (C, pthread_mutexattr_setpshared, pthread_mutexattr_setpshared_LINKNAME); To_pshared : constant array (Boolean) of int := (True => PTHREAD_PROCESS_SHARED, False => PTHREAD_PROCESS_PRIVATE); procedure Set_Process_Shared (Attr : in out Attributes; Is_Shared : Boolean := False) is begin Check_NZ (pthread_mutexattr_setpshared (Attr.Attr'Unchecked_Access, To_pshared (Is_Shared))); end Set_Process_Shared; -------------------------- -- Set_Locking_Policy -- -------------------------- function pthread_mutexattr_setprotocol (attr : access pthread_mutexattr_t; protocol : int) return int; pragma Import (C, pthread_mutexattr_setprotocol, pthread_mutexattr_setprotocol_LINKNAME); To_C_Policy : constant array (Locking_Policy) of int := (No_Priority_Inheritance => PTHREAD_PRIO_NONE, Highest_Blocked_Task => PTHREAD_PRIO_INHERIT, Highest_Ceiling_Priority => PTHREAD_PRIO_PROTECT); procedure Set_Locking_Policy (Attr : in out Attributes; Locking : Locking_Policy) is begin Check_NZ (pthread_mutexattr_setprotocol (Attr.Attr'Unchecked_Access, To_C_Policy (Locking))); end Set_Locking_Policy; -------------------------- -- Get_Locking_Policy -- -------------------------- function pthread_mutexattr_getprotocol (attr : Mutexattr_Descriptor; value_ptr : access int) return int; pragma Import (C, pthread_mutexattr_getprotocol, pthread_mutexattr_getprotocol_LINKNAME); function Get_Locking_Policy (Attr : Attributes) return Locking_Policy is Result : aliased int; begin Check_NZ (pthread_mutexattr_getprotocol (Attr.Attr'Unchecked_Access, Result'Unchecked_Access)); if Result = PTHREAD_PRIO_NONE then return No_Priority_Inheritance; elsif Result = PTHREAD_PRIO_INHERIT then return Highest_Blocked_Task; elsif Result = PTHREAD_PRIO_PROTECT then return Highest_Ceiling_Priority; else Raise_POSIX_Error (Operation_Not_Supported); -- to suppress compiler warning return No_Priority_Inheritance; end if; end Get_Locking_Policy; ---------------------------- -- Set_Ceiling_Priority -- ---------------------------- function pthread_mutexattr_setprioceiling (attr : access pthread_mutexattr_t; prioceiling : int) return int; pragma Import (C, pthread_mutexattr_setprioceiling, pthread_mutexattr_setprioceiling_LINKNAME); procedure Set_Ceiling_Priority (Attr : in out Attributes; New_Ceiling : Ceiling_Priority) is begin Check_NZ (pthread_mutexattr_setprioceiling (Attr.Attr'Unchecked_Access, int (New_Ceiling))); end Set_Ceiling_Priority; ---------------------------- -- Get_Ceiling_Priority -- ---------------------------- function pthread_mutexattr_getprioceiling (attr : Mutexattr_Descriptor; prioceiling : access int) return int; pragma Import (C, pthread_mutexattr_getprioceiling, pthread_mutexattr_getprioceiling_LINKNAME); function Get_Ceiling_Priority (Attr : Attributes) return Ceiling_Priority is Result : aliased int; begin Check_NZ (pthread_mutexattr_getprioceiling (Attr.Attr'Unchecked_Access, Result'Unchecked_Access)); return (Ceiling_Priority (Result)); end Get_Ceiling_Priority; ------------------ -- Initialize -- ------------------ function pthread_mutex_init (mutex : access pthread_mutex_t; attr : Mutexattr_Descriptor) return int; pragma Import (C, pthread_mutex_init, pthread_mutex_init_LINKNAME); procedure Initialize (M : in out Mutex; Attr : Attributes) is begin Check_NZ (pthread_mutex_init (M.Mutex'Unchecked_Access, Attr.Attr'Unchecked_Access)); end Initialize; procedure Initialize (M : in out Mutex) is begin Check_NZ (pthread_mutex_init (M.Mutex'Unchecked_Access, null)); end Initialize; --------------------- -- Descriptor_Of -- --------------------- function Descriptor_Of (M : Mutex) return Mutex_Descriptor is begin return M.Mutex'Unchecked_Access; end Descriptor_Of; ---------------- -- Finalize -- ---------------- function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int; pragma Import (C, pthread_mutex_destroy, pthread_mutex_destroy_LINKNAME); procedure Finalize (M : in out Mutex) is begin Check_NZ (pthread_mutex_destroy (M.Mutex'Unchecked_Access)); end Finalize; ---------------------------- -- Set_Ceiling_Priority -- ---------------------------- type int_ptr is access all int; function pthread_mutex_setprioceiling (mutex : Mutex_Descriptor; prioceiling : int; old_ceiling : int_ptr) return int; pragma Import (C, pthread_mutex_setprioceiling, pthread_mutex_setprioceiling_LINKNAME); procedure Set_Ceiling_Priority (M : Mutex_Descriptor; New_Ceiling : Ceiling_Priority; Old_Ceiling : out Ceiling_Priority) is Result : aliased int; begin Check_NZ (pthread_mutex_setprioceiling (M, int (New_Ceiling), Result'Unchecked_Access)); Old_Ceiling := Ceiling_Priority (Result); end Set_Ceiling_Priority; ---------------------------- -- Get_Ceiling_Priority -- ---------------------------- function pthread_mutex_getprioceiling (mutex : Mutex_Descriptor; prioceiling : access int) return int; pragma Import (C, pthread_mutex_getprioceiling, pthread_mutex_getprioceiling_LINKNAME); function Get_Ceiling_Priority (M : Mutex_Descriptor) return Ceiling_Priority is Result : aliased int; begin Check_NZ (pthread_mutex_getprioceiling (M, Result'Unchecked_Access)); return Ceiling_Priority (Result); end Get_Ceiling_Priority; ------------ -- Lock -- ------------ function pthread_mutex_lock (mutex : Mutex_Descriptor) return int; pragma Import (C, pthread_mutex_lock, pthread_mutex_lock_LINKNAME); procedure Lock (M : Mutex_Descriptor) is begin Check_NZ (pthread_mutex_lock (M)); end Lock; ---------------- -- Try_Lock -- ---------------- function pthread_mutex_trylock (mutex : Mutex_Descriptor) return int; pragma Import (C, pthread_mutex_trylock, pthread_mutex_trylock_LINKNAME); function Try_Lock (M : Mutex_Descriptor) return Boolean is Result : constant int := pthread_mutex_trylock (M); -- Note: pthread_mutex_trylock returns an error code in Result, and -- does not set errno. begin case Result is when 0 => return True; when EBUSY => return False; when others => Raise_POSIX_Error (Error_Code (Result)); end case; end Try_Lock; -------------- -- Unlock -- -------------- function pthread_mutex_unlock (mutex : Mutex_Descriptor) return int; pragma Import (C, pthread_mutex_unlock, pthread_mutex_unlock_LINKNAME); procedure Unlock (M : Mutex_Descriptor) is begin Check_NZ (pthread_mutex_unlock (M)); end Unlock; end POSIX.Mutexes; florist-gpl-2017-src/libsrc/posix_process_environment.ads0000644000076700001450000000566413106553472023323 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ P R O C E S S _ E N V I R O N M E N T -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Process_Environment; pragma Elaborate_All (POSIX.Process_Environment); package POSIX_Process_Environment renames POSIX.Process_Environment; florist-gpl-2017-src/libsrc/posix-process_times.ads0000644000076700001450000000741113106553472022006 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P R O C E S S _ T I M E S -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX.C; package POSIX.Process_Times is type Tick_Count is new POSIX.C.clock_t; -- Minimally 0 to 24 hours Ticks_Per_Second : constant Tick_Count; function Elapsed_Real_Time return Tick_Count; type Process_Times is private; function Get_Process_Times return Process_Times; function Elapsed_Real_Time_Of (Times : Process_Times) return Tick_Count; function User_CPU_Time_Of (Times : Process_Times) return Tick_Count; function System_CPU_Time_Of (Times : Process_Times) return Tick_Count; function Descendants_User_CPU_Time_Of (Times : Process_Times) return Tick_Count; function Descendants_System_CPU_Time_Of (Times : Process_Times) return Tick_Count; private function sysconf (c_name : POSIX.C.int) return POSIX.C.long; pragma Import (C, sysconf, POSIX.C.sysconf_LINKNAME); Ticks_Per_Second : constant Tick_Count := Tick_Count (sysconf (POSIX.C.SC_CLK_TCK)); type Process_Times is record tms : aliased POSIX.C.struct_tms; Elapsed_Real_Time : POSIX.C.clock_t; end record; end POSIX.Process_Times; florist-gpl-2017-src/libsrc/posix_shared_memory_objects.ads0000644000076700001450000000567413106553472023571 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ S H A R E D _ M E M O R Y _ O B J E C T S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Shared_Memory_Objects; pragma Elaborate_All (POSIX.Shared_Memory_Objects); package POSIX_Shared_Memory_Objects renames POSIX.Shared_Memory_Objects; florist-gpl-2017-src/libsrc/posix-generic_shared_memory.adb0000644000076700001450000003065313106553472023444 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . G E N E R I C _ S H A R E D _ M E M O R Y -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2010, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- See the warnings in the package spec. -- This package presents potential semantic and implementation -- problems. We do not want shared objects to be reinitialized for -- each process that uses them. We do not want shared objects -- finalized, or at least not until the "last close" of the -- shared memory object in which they reside. -- The present implementation makes no attempt to deal correctly -- with controlled types. -- It also relies on the assumption that an "access all" pointer -- is meaningfully unchecked-convertible to an ordinary "access" -- value. -- .... -- This has several critical sections, to give the effect of atomicity -- from a series of system calls. -- We have put exception handlers around these, to make sure the lock -- gets released if there happens to be an exception. -- In some cases we may be able to convince ourselves that no exception -- is possible, but there is still the possibility of Storage_Error. with POSIX.Implementation, POSIX.Memory_Range_Locking, POSIX.Shared_Memory_Objects, System, System.Storage_Elements, Unchecked_Conversion; package body POSIX.Generic_Shared_Memory is use POSIX.Implementation; use type POSIX.IO.File_Descriptor; use type POSIX.Memory_Mapping.Protection_Options; Length : constant POSIX.IO_Count := Object_Type'Max_Size_In_Storage_Elements; type Private_Ptr is access all Object_Type; function To_Shared_Access is new Unchecked_Conversion (Private_Ptr, Shared_Access); -- One instantiation of this package can be used to open -- several shared memory objects, with different file descriptors. -- We need a list to keep track of the mapping from file descriptor -- to start-address. type Node; type Node_List is access all Node; type Node is record FD : POSIX.IO.File_Descriptor; Start_addr : System.Address; Pointer : Private_Ptr; Next : Node_List; end record; Head : Node_List := null; pragma Volatile (Head); Avail : Node_List := null; pragma Volatile (Avail); ------------------------ -- Local Subprograms -- ------------------------ procedure Insert_Node (FD : POSIX.IO.File_Descriptor; Start : System.Address); function Start_Of_Shared_Memory (File : POSIX.IO.File_Descriptor) return System.Address; procedure Remove_Node (FD : POSIX.IO.File_Descriptor); ------------------- -- Insert_Node -- ------------------- procedure Insert_Node (FD : POSIX.IO.File_Descriptor; Start : System.Address) is T : Node_List; -- The local object is necessary to force initialization. -- Unfortunately, it means that if the type has finalization -- we also get the finalization, before we return from this call. -- .... That is unwanted, but what else can we do? X : aliased Object_Type; for X'Address use Start; begin if Avail /= null then T := Avail; Avail := Avail.Next; else T := new Node; end if; T.FD := FD; T.Start_addr := Start; T.Pointer := X'Unchecked_Access; T.Next := Head; Head := T; end Insert_Node; ------------------- -- Remove_Node -- ------------------- procedure Remove_Node (FD : POSIX.IO.File_Descriptor) is T, Prev : Node_List; begin T := Head; Prev := Head; while T /= null loop if T.FD = FD then if Prev = T then Head := T.Next; else Prev.Next := T.Next; end if; T.Next := Avail; Avail := T; return; else Prev := T; T := T.Next; end if; end loop; Raise_POSIX_Error (POSIX.Bad_File_Descriptor); end Remove_Node; ------------------------------ -- Start_Of_Shared_Memory -- ------------------------------ function Start_Of_Shared_Memory (File : POSIX.IO.File_Descriptor) return System.Address is T : Node_List; begin Begin_Critical_Section; begin T := Head; while T /= null loop if T.FD = File then End_Critical_Section; return T.Start_addr; end if; T := T.Next; end loop; End_Critical_Section; exception when others => End_Critical_Section; raise; end; Raise_POSIX_Error (POSIX.Bad_File_Descriptor); -- to suppress compiler warning: return System.Null_Address; end Start_Of_Shared_Memory; ---------------------------------- -- Open_And_Map_Shared_Memory -- ---------------------------------- -- No adjustment of signal mask in these procedures. -- We just pass on the masking information to the "open". function Open_And_Map_Shared_Memory (Name : POSIX.POSIX_String; Protection : POSIX.Memory_Mapping.Protection_Options; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return POSIX.IO.File_Descriptor is FD : POSIX.IO.File_Descriptor; Mode : POSIX.IO.File_Mode; begin if Protection >= POSIX.Memory_Mapping.Allow_Write then Mode := POSIX.IO.Read_Write; else Mode := POSIX.IO.Read_Only; end if; Begin_Critical_Section; begin FD := POSIX.Shared_Memory_Objects.Open_Shared_Memory (Name, Mode, POSIX.IO.Empty_Set, Masked_Signals); if Protection >= POSIX.Memory_Mapping.Allow_Write then POSIX.IO.Truncate_File (FD, Length); end if; Insert_Node (FD, POSIX.Memory_Mapping.Map_Memory (System.Storage_Elements.Storage_Offset (Length), Protection, POSIX.Memory_Mapping.Map_Shared, FD, 0)); End_Critical_Section; exception when others => End_Critical_Section; raise; end; return FD; end Open_And_Map_Shared_Memory; -------------------------------------------- -- Open_Or_Create_And_Map_Shared_Memory -- -------------------------------------------- function Open_Or_Create_And_Map_Shared_Memory (Name : POSIX.POSIX_String; Protection : POSIX.Memory_Mapping.Protection_Options; Permissions : POSIX.Permissions.Permission_Set; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return POSIX.IO.File_Descriptor is FD : POSIX.IO.File_Descriptor; Mode : POSIX.IO.File_Mode; begin if Protection >= POSIX.Memory_Mapping.Allow_Write then Mode := POSIX.IO.Read_Write; else Mode := POSIX.IO.Read_Only; end if; Begin_Critical_Section; begin FD := POSIX.Shared_Memory_Objects.Open_Or_Create_Shared_Memory (Name, Mode, Permissions, Options, Masked_Signals); if Protection >= POSIX.Memory_Mapping.Allow_Write then POSIX.IO.Truncate_File (FD, Length); end if; Insert_Node (FD, POSIX.Memory_Mapping.Map_Memory (System.Storage_Elements.Storage_Offset (Length), Protection, POSIX.Memory_Mapping.Map_Shared, FD, 0)); End_Critical_Section; exception when others => End_Critical_Section; raise; end; return FD; end Open_Or_Create_And_Map_Shared_Memory; ---------------------------- -- Access_Shared_Memory -- ---------------------------- function Access_Shared_Memory (File : POSIX.IO.File_Descriptor) return Shared_Access is T : Node_List; begin Begin_Critical_Section; begin T := Head; while T /= null loop if T.FD = File then End_Critical_Section; return To_Shared_Access (T.Pointer); end if; T := T.Next; end loop; End_Critical_Section; exception when others => End_Critical_Section; raise; end; Raise_POSIX_Error (POSIX.Bad_File_Descriptor); -- To suppress compiler warning message: return null; end Access_Shared_Memory; ------------------------------------- -- Unmap_And_Close_Shared_Memory -- ------------------------------------- procedure Unmap_And_Close_Shared_Memory (File : POSIX.IO.File_Descriptor) is begin Begin_Critical_Section; begin POSIX.Memory_Mapping.Unmap_Memory (Start_Of_Shared_Memory (File), Object_Type'Max_Size_In_Storage_Elements); Remove_Node (File); POSIX.IO.Close (File); End_Critical_Section; exception when others => End_Critical_Section; raise; end; -- .... If we could detect "last close", and if we could -- detect that the type has finalization, we might want to -- call finalization here, for the last close. end Unmap_And_Close_Shared_Memory; -------------------------- -- Lock_Shared_Memory -- -------------------------- procedure Lock_Shared_Memory (File : POSIX.IO.File_Descriptor) is begin POSIX.Memory_Range_Locking.Lock_Range (Start_Of_Shared_Memory (File), System.Storage_Elements.Storage_Offset (Object_Type'Max_Size_In_Storage_Elements)); end Lock_Shared_Memory; ---------------------------- -- Unlock_Shared_Memory -- ---------------------------- procedure Unlock_Shared_Memory (File : POSIX.IO.File_Descriptor) is begin POSIX.Memory_Range_Locking.Unlock_Range (Start_Of_Shared_Memory (File), System.Storage_Elements.Storage_Offset (Object_Type'Max_Size_In_Storage_Elements)); end Unlock_Shared_Memory; end POSIX.Generic_Shared_Memory; florist-gpl-2017-src/libsrc/posix_file_locking.ads0000644000076700001450000000574713106553472021650 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ F I L E _ L O C K I N G -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 1991-1994 Florida State University -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.File_Locking; pragma Elaborate_All (POSIX.File_Locking); package POSIX_File_Locking renames POSIX.File_Locking; florist-gpl-2017-src/libsrc/posix-page_alignment.ads0000644000076700001450000000661213106553472022103 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P A G E _ A L I G N M E N T -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX, System, System.Storage_Elements; package POSIX.Page_Alignment is function Truncate_To_Page (Addr : System.Address) return System.Address; function Truncate_To_Page (Offset : POSIX.IO_Count) return POSIX.IO_Count; function Adjust_Length (Addr : System.Address; Length : System.Storage_Elements.Storage_Offset) return System.Storage_Elements.Storage_Offset; function Adjust_Length (Offset : POSIX.IO_Count; Length : System.Storage_Elements.Storage_Offset) return System.Storage_Elements.Storage_Offset; function Length (Size : Natural) return System.Storage_Elements.Storage_Offset; end POSIX.Page_Alignment; florist-gpl-2017-src/libsrc/posix_semaphores.ads0000644000076700001450000000562013106553472021357 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ S E M A P H O R E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Semaphores; pragma Elaborate_All (POSIX.Semaphores); package POSIX_Semaphores renames POSIX.Semaphores; florist-gpl-2017-src/libsrc/posix_process_times.ads0000644000076700001450000000563413106553472022075 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ P R O C E S S _ T I M E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Process_Times; pragma Elaborate_All (POSIX.Process_Times); package POSIX_Process_Times renames POSIX.Process_Times; florist-gpl-2017-src/libsrc/posix_configurable_system_limits.ads0000644000076700001450000000604113106553472024634 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ C O N F I G U R A B L E _ S Y S T E M _ L I M I T S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 1991-1994 Florida State University -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Configurable_System_Limits; pragma Elaborate_All (POSIX.Configurable_System_Limits); package POSIX_Configurable_System_Limits renames POSIX.Configurable_System_Limits; florist-gpl-2017-src/libsrc/posix_unsafe_process_primitives.ads0000644000076700001450000000571613106553472024511 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ U N S A F E _ P R O C E S S _ P R I M I T I V E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Unsafe_Process_Primitives; pragma Elaborate_All (POSIX.Unsafe_Process_Primitives); package POSIX_Unsafe_Process_Primitives renames POSIX.Unsafe_Process_Primitives; florist-gpl-2017-src/libsrc/posix-page_alignment.adb0000644000076700001450000001166013106553472022061 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P A G E _ A L I G N M E N T -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Configurable_System_Limits; pragma Elaborate_All (POSIX.Configurable_System_Limits); package body POSIX.Page_Alignment is use System.Storage_Elements, System; Page_Size : constant Storage_Offset := Storage_Offset (POSIX.Configurable_System_Limits.Page_Size); ------------------------ -- Truncate_To_Page -- ------------------------ function Truncate_To_Page (Addr : Address) return Address is begin if Page_Size /= 0 then return Addr - (Addr mod Page_Size); else return Addr; end if; end Truncate_To_Page; function Truncate_To_Page (Offset : IO_Count) return IO_Count is begin if Page_Size /= 0 then return Offset - (Offset rem IO_Count (Page_Size)); else return Offset; end if; end Truncate_To_Page; --------------------- -- Adjust_Length -- --------------------- function Adjust_Length (Addr : Address; Length : Storage_Offset) return Storage_Offset is L : Storage_Offset; begin L := Length + Addr - Truncate_To_Page (Addr); if Page_Size = 0 then return L; end if; if L mod Page_Size = 0 then return L; end if; return Page_Size * (L / Page_Size + 1); end Adjust_Length; function Adjust_Length (Offset : IO_Count; Length : Storage_Offset) return Storage_Offset is O : IO_Count; L : Storage_Offset; begin O := Offset - Truncate_To_Page (Offset); L := Length + Storage_Offset (O); if Page_Size = 0 then return L; end if; if L mod Page_Size = 0 then return L; end if; return Page_Size * (L / Page_Size + 1); end Adjust_Length; -------------- -- Length -- -------------- function Length (Size : Natural) return Storage_Offset is begin if Size mod System.Storage_Unit = 0 then return Storage_Offset (Size); else return Storage_Offset (Size / System.Storage_Unit + 1); end if; end Length; end POSIX.Page_Alignment; florist-gpl-2017-src/libsrc/posix-configurable_system_limits.ads0000644000076700001450000002003113106553472024545 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . C O N F I G U R A B L E _ S Y S T E M _ L I M I T S -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.Limits, POSIX.Options; package POSIX.Configurable_System_Limits is function Asynchronous_IO_Is_Supported return POSIX.Options.Asynchronous_IO_Support; function File_Synchronization_Is_Supported return POSIX.Options.File_Synchronization_Support; function Job_Control_Supported -- obsolescent return POSIX.Job_Control_Support; -- obsolescent function Job_Control_Is_Supported return POSIX.Options.Job_Control_Support renames Job_Control_Supported; function Memory_Mapped_Files_Are_Supported return POSIX.Options.Memory_Mapped_Files_Support; function Memory_Locking_Is_Supported return POSIX.Options.Memory_Locking_Support; function Memory_Range_Locking_Is_Supported return POSIX.Options.Memory_Range_Locking_Support; function Memory_Protection_Is_Supported return POSIX.Options.Memory_Protection_Support; function Message_Queues_Are_Supported return POSIX.Options.Message_Queues_Support; function Mutex_Priority_Ceiling_Is_Supported return POSIX.Options.Mutex_Priority_Ceiling_Support; function Mutex_Priority_Inheritance_Is_Supported return POSIX.Options.Mutex_Priority_Inheritance_Support; function Mutexes_Are_Supported return POSIX.Options.Mutexes_Support; function Prioritized_IO_Is_Supported return POSIX.Options.Prioritized_IO_Support; function Process_Shared_Is_Supported return POSIX.Options.Process_Shared_Support; function Priority_Process_Scheduling_Is_Supported return POSIX.Options.Priority_Process_Scheduling_Support; function Priority_Task_Scheduling_Is_Supported return POSIX.Options.Priority_Task_Scheduling_Support; function Realtime_Signals_Are_Supported return POSIX.Options.Realtime_Signals_Support; function Saved_IDs_Supported -- obsolescent return POSIX.Saved_IDs_Support; -- obsolescent function Saved_IDs_Are_Supported return POSIX.Options.Saved_IDs_Support renames Saved_IDs_Supported; function Semaphores_Are_Supported return POSIX.Options.Semaphores_Support; function Shared_Memory_Objects_Are_Supported return POSIX.Options.Shared_Memory_Objects_Support; function Synchronized_IO_Is_Supported return POSIX.Options.Synchronized_IO_Support; function Timers_Are_Supported return POSIX.Options.Timers_Support; type POSIX_Version is new POSIX.C.long; function System_POSIX_Version return POSIX_Version; function System_POSIX_Ada_Version return POSIX_Version; function Argument_List_Maximum return POSIX.Limits.Argument_List_Maxima; function Asynchronous_IO_Maximum return POSIX.Limits.Asynchronous_IO_Maxima; function Asynchronous_IO_Priority_Delta_Maximum return POSIX.Limits.Asynchronous_IO_Priority_Delta_Maxima; function Child_Processes_Maximum return POSIX.Limits.Child_Processes_Maxima; function Groups_Maximum return POSIX.Limits.Groups_Maxima; function List_IO_Maximum return POSIX.Limits.List_IO_Maxima; function Open_Message_Queues_Maximum return POSIX.Limits.Open_Message_Queues_Maxima; function Message_Priority_Maximum return POSIX.Limits.Message_Priority_Maxima; function Open_Files_Maximum return POSIX.Limits.Open_Files_Maxima; function Page_Size return POSIX.Limits.Page_Size_Range; function Queued_Signals_Maximum return POSIX.Limits.Queued_Signals_Maxima; function Realtime_Signals_Maximum return POSIX.Limits.Realtime_Signals_Maxima; function Semaphores_Maximum return POSIX.Limits.Semaphores_Maxima; function Semaphores_Value_Maximum return POSIX.Limits.Semaphores_Value_Maxima; function Stream_Maximum -- obsolescent return POSIX.Stream_Maxima; -- obsolescent function Streams_Maximum return POSIX.Limits.Streams_Maxima renames Stream_Maximum; function Timers_Maximum return POSIX.Limits.Timers_Maxima; function Timer_Overruns_Maximum return POSIX.Limits.Timer_Overruns_Maxima; function Time_Zone_String_Maximum return POSIX.Limits.Time_Zone_String_Maxima; -- POSIX.5c/D4 extensions function Internet_Datagram_Is_Supported return POSIX.Options.Internet_Datagram_Support; function Internet_Protocol_Is_Supported return POSIX.Options.Internet_Protocol_Support; function Internet_Stream_Is_Supported return POSIX.Options.Internet_Stream_Support; function ISO_OSI_Protocol_Is_Supported return POSIX.Options.ISO_OSI_Protocol_Support; function Network_Management_Is_Supported return POSIX.Options.Network_Management_Support; function OSI_Connectionless_Is_Supported return POSIX.Options.OSI_Connectionless_Support; function OSI_Connection_Is_Supported return POSIX.Options.OSI_Connection_Support; function OSI_Minimal_Is_Supported return POSIX.Options.OSI_Minimal_Support; function Poll_Is_Supported return POSIX.Options.Poll_Support; function Select_Is_Supported return POSIX.Options.Select_Support; function Sockets_DNI_Is_Supported return POSIX.Options.Sockets_DNI_Support; function Socket_IO_Vector_Maximum return POSIX.Limits.Socket_IO_Vector_Maxima; function XTI_DNI_Is_Supported return POSIX.Options.XTI_DNI_Support; end POSIX.Configurable_System_Limits; florist-gpl-2017-src/libsrc/posix-terminal_functions.ads0000644000076700001450000002245113106553472023033 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . T E R M I N A L _ F U N C T I O N S -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.IO, POSIX.Process_Identification; package POSIX.Terminal_Functions is -- Special Characters used in terminal input Null_POSIX_Character : constant POSIX.POSIX_Character := POSIX.POSIX_Character'Val (0); Flag_POSIX_Character : constant POSIX.POSIX_Character := POSIX.POSIX_Character'Val (0); -- Get and Define Terminal operating characteristics type Terminal_Characteristics is private; Invalid_Terminal_Characteristics : constant Terminal_Characteristics; function Get_Terminal_Characteristics (File : POSIX.IO.File_Descriptor) return Terminal_Characteristics; type Terminal_Action_Times is (Immediately, After_Output, After_Output_And_Input); procedure Set_Terminal_Characteristics (File : POSIX.IO.File_Descriptor; Characteristics : Terminal_Characteristics; Apply : Terminal_Action_Times := Immediately; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); type Terminal_Modes is -- Subtype Input_Modes: (Interrupt_On_Break, Map_CR_To_LF, Ignore_Break, Ignore_CR, Ignore_Parity_Errors, Map_LF_To_CR, Enable_Parity_Check, Strip_Character, Enable_Start_Stop_Input, Enable_Start_Stop_Output, Mark_Parity_Errors, -- Subtype Output_Modes : Perform_Output_Processing, -- Subtype Control_Modes : Ignore_Modem_Status, Enable_Receiver, Send_Two_Stop_Bits, Hang_Up_On_Last_Close, Parity_Enable, Odd_Parity, -- Subtype Local_Modes: Echo, Echo_Erase, Echo_Kill, Echo_LF, Canonical_Input, Extended_Functions, Enable_Signals, No_Flush, Send_Signal_For_BG_Output); subtype Input_Modes is Terminal_Modes range Interrupt_On_Break .. Mark_Parity_Errors; subtype Output_Modes is Terminal_Modes range Perform_Output_Processing .. Perform_Output_Processing; subtype Control_Modes is Terminal_Modes range Ignore_Modem_Status .. Odd_Parity; subtype Local_Modes is Terminal_Modes range Echo .. Send_Signal_For_BG_Output; type Terminal_Modes_Set is array (Terminal_Modes) of Boolean; subtype Bits_Per_Character is Positive range 5 .. 8; type Baud_Rate is (B0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400, B4800, B9600, B19200, B38400, B57600, B115200, B230400, B460800); function Terminal_Modes_Of (Characteristics : Terminal_Characteristics) return Terminal_Modes_Set; procedure Define_Terminal_Modes (Characteristics : in out Terminal_Characteristics; Modes : Terminal_Modes_Set); function Bits_Per_Character_Of (Characteristics : Terminal_Characteristics) return Bits_Per_Character; procedure Define_Bits_Per_Character (Characteristics : in out Terminal_Characteristics; Bits : Bits_Per_Character); function Input_Baud_Rate_Of (Characteristics : Terminal_Characteristics) return Baud_Rate; procedure Define_Input_Baud_Rate (Characteristics : in out Terminal_Characteristics; Input_Baud_Rate : Baud_Rate); function Output_Baud_Rate_Of (Characteristics : Terminal_Characteristics) return Baud_Rate; procedure Define_Output_Baud_Rate (Characteristics : in out Terminal_Characteristics; Output_Baud_Rate : Baud_Rate); type Control_Character_Selector is (EOF_Char, EOL_Char, Erase_Char, Interrupt_Char, Kill_Char, Quit_Char, Suspend_Char, Start_Char, Stop_Char); function Special_Control_Character_Of (Characteristics : Terminal_Characteristics; Selector : Control_Character_Selector) return POSIX.POSIX_Character; procedure Define_Special_Control_Character (Characteristics : in out Terminal_Characteristics; Selector : Control_Character_Selector; Char : POSIX.POSIX_Character); procedure Disable_Control_Character (Characteristics : in out Terminal_Characteristics; Selector : Control_Character_Selector); function Input_Time_Of (Characteristics : Terminal_Characteristics) return Duration; procedure Define_Input_Time (Characteristics : in out Terminal_Characteristics; Input_Time : Duration); function Minimum_Input_Count_Of (Characteristics : Terminal_Characteristics) return Natural; procedure Define_Minimum_Input_Count (Characteristics : in out Terminal_Characteristics; Minimum_Input_Count : Natural); -- Line Control Operations procedure Send_Break (File : POSIX.IO.File_Descriptor; The_Duration : Duration := 0.0); procedure Drain (File : POSIX.IO.File_Descriptor; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); type Queue_Selector is (Received_But_Not_Read, Written_But_Not_Transmitted, Both); procedure Discard_Data (File : POSIX.IO.File_Descriptor; Selector : Queue_Selector); type Flow_Action is (Suspend_Output, Restart_Output, Transmit_Stop, Transmit_Start); procedure Flow (File : POSIX.IO.File_Descriptor; Action : Flow_Action); -- Foreground Process Group ID function Get_Process_Group_ID (File : POSIX.IO.File_Descriptor) return POSIX.Process_Identification.Process_Group_ID; procedure Set_Process_Group_ID (File : POSIX.IO.File_Descriptor; Group_ID : POSIX.Process_Identification.Process_Group_ID); -- Get pathname of current controlling terminal for the current process function Get_Controlling_Terminal_Name return POSIX.Pathname; private -- .... Change POSIX.5? -- This is a terrible choice of interface. -- The type Terminal_Characteristics should have been a -- limited private type, but is is declared private here! -- We are forced to do strange contortions to provide: -- (1) implicit initialization of objects of this type to -- a recognizable "undefined" value -- (2) a constant to stand for this undefined value -- (3) no use of "access types" -- i.e. heap allocation -- Were it not for the latter, we could easily map the type -- Terminal_Characteristics to the C type struct termios *. type Terminal_Characteristics is record Valid : Boolean := False; termios : aliased POSIX.C.struct_termios; end record; Dummy : Terminal_Characteristics; -- provides a default initial value, without depending on -- internal structure of type POSIX.C.struct_termios Invalid_Terminal_Characteristics : constant Terminal_Characteristics := Dummy; end POSIX.Terminal_Functions; florist-gpl-2017-src/libsrc/posix-process_scheduling.adb0000644000076700001450000001721113106553472022770 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P R O C E S S _ S C H E D U L I N G -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation, POSIX.Process_Identification, Unchecked_Conversion; package body POSIX.Process_Scheduling is use POSIX.C; use POSIX.Implementation; -------------------- -- Get_Priority -- -------------------- function Get_Priority (Parameters : Scheduling_Parameters) return Scheduling_Priority is begin return Scheduling_Priority (Parameters.Param.sched_priority); end Get_Priority; -------------------- -- Set_Priority -- -------------------- procedure Set_Priority (Parameters : in out Scheduling_Parameters; Priority : Scheduling_Priority) is begin Parameters.Param.sched_priority := int (Priority); end Set_Priority; --------------------------------- -- Set_Scheduling_Parameters -- --------------------------------- function sched_setparam (pid : pid_t; param : sched_param_ptr) return int; pragma Import (C, sched_setparam, sched_setparam_LINKNAME); function To_pid_t is new Unchecked_Conversion (POSIX.Process_Identification.Process_ID, pid_t); procedure Set_Scheduling_Parameters (Process : POSIX_Process_Identification.Process_ID; Parameters : Scheduling_Parameters) is begin Check (sched_setparam (To_pid_t (Process), Parameters.Param'Unchecked_Access)); end Set_Scheduling_Parameters; --------------------------------- -- Get_Scheduling_Parameters -- --------------------------------- function sched_getparam (pid : pid_t; param : access struct_sched_param) return int; pragma Import (C, sched_getparam, sched_getparam_LINKNAME); function Get_Scheduling_Parameters (Process : POSIX_Process_Identification.Process_ID) return Scheduling_Parameters is Params : aliased Scheduling_Parameters; begin Check (sched_getparam (To_pid_t (Process), Params.Param'Unchecked_Access)); return Params; end Get_Scheduling_Parameters; ----------------------------- -- Set_Scheduling_Policy -- ----------------------------- function sched_setscheduler (pid : pid_t; policy : int; param : sched_param_ptr) return int; pragma Import (C, sched_setscheduler, sched_setscheduler_LINKNAME); procedure Set_Scheduling_Policy (Process : POSIX_Process_Identification.Process_ID; New_Policy : Scheduling_Policy; Parameters : Scheduling_Parameters) is begin Check (sched_setscheduler (To_pid_t (Process), int (New_Policy), Parameters.Param'Unchecked_Access)); end Set_Scheduling_Policy; ----------------------------- -- Get_Scheduling_Policy -- ----------------------------- function sched_getscheduler (pid : pid_t) return int; pragma Import (C, sched_getscheduler, sched_getscheduler_LINKNAME); function Get_Scheduling_Policy (Process : POSIX_Process_Identification.Process_ID) return Scheduling_Policy is begin return Scheduling_Policy (Check (sched_getscheduler (To_pid_t (Process)))); end Get_Scheduling_Policy; ------------- -- Yield -- ------------- function sched_yield return int; pragma Import (C, sched_yield, sched_yield_LINKNAME); procedure Yield is begin Check (sched_yield); end Yield; ---------------------------- -- Get_Maximum_Priority -- ---------------------------- function sched_get_priority_max (policy : int) return int; pragma Import (C, sched_get_priority_max, sched_get_priority_max_LINKNAME); function Get_Maximum_Priority (Policy : Scheduling_Policy) return Scheduling_Priority is begin return Scheduling_Priority (Check (sched_get_priority_max (int (Policy)))); end Get_Maximum_Priority; ---------------------------- -- Get_Minimum_Priority -- ---------------------------- function sched_get_priority_min (policy : int) return int; pragma Import (C, sched_get_priority_min, sched_get_priority_min_LINKNAME); function Get_Minimum_Priority (Policy : Scheduling_Policy) return Scheduling_Priority is begin return Scheduling_Priority (Check (sched_get_priority_min (int (Policy)))); end Get_Minimum_Priority; --------------------------------- -- Get_Round_Robin_Interval -- --------------------------------- function sched_rr_get_interval (pid : pid_t; interval : access struct_timespec) return int; pragma Import (C, sched_rr_get_interval, sched_rr_get_interval_LINKNAME); function Get_Round_Robin_Interval (Process : POSIX_Process_Identification.Process_ID) return POSIX.Timespec is TS : aliased struct_timespec; begin Check (sched_rr_get_interval (To_pid_t (Process), TS'Unchecked_Access)); return To_Timespec (TS); end Get_Round_Robin_Interval; end POSIX.Process_Scheduling; florist-gpl-2017-src/libsrc/posix-permissions.adb0000644000076700001450000001236713106553472021467 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P E R M I S S I O N S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (c) 1996, 1997 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.Implementation, POSIX.Permissions.Implementation; package body POSIX.Permissions is use POSIX.C; use POSIX.Implementation; use POSIX.Permissions.Implementation; ------------------------ -- local declarations -- ------------------------ Cached_Umask : mode_t := 0; ----------------------- -- local subprograms -- ----------------------- function umask (c_mask : mode_t) return mode_t; pragma Import (C, umask, umask_LINKNAME); --------------------------------------- -- Get_Allowed_Process_Permissions -- --------------------------------------- function Get_Allowed_Process_Permissions return Permission_Set is Mask : mode_t; begin Begin_Critical_Section; Mask := umask (Cached_Umask); if Mask /= Cached_Umask then Cached_Umask := Mask; Mask := umask (Mask); end if; End_Critical_Section; return Form_Ada_Permission ((not Cached_Umask) and File_Access_Permission_Bits); -- The allowed process permissions are the complement of the -- file permission bits in umask. -- The Ada interface requires that the other bits be zero. -- We cache the old umask, to reduce the number of calls. end Get_Allowed_Process_Permissions; --------------------------------------- -- Set_Allowed_Process_Permissions -- --------------------------------------- procedure Set_Allowed_Process_Permissions (Permissions : Permission_Set) is Mask : mode_t := not (Form_C_Permission (Permissions) and File_Access_Permission_Bits); -- Mask is assigned to but never referenced when umask is -- evaluated for its side effect. pragma Warnings (Off, Mask); begin Cached_Umask := Mask; Mask := umask (Mask); end Set_Allowed_Process_Permissions; --------------------------------------- -- Set_Allowed_Process_Permissions -- --------------------------------------- procedure Set_Allowed_Process_Permissions (Permissions : Permission_Set; Old_Perms : out Permission_Set) is Mask : constant mode_t := not (Form_C_Permission (Permissions) and File_Access_Permission_Bits); begin Cached_Umask := Mask; Old_Perms := Form_Ada_Permission ((not umask (Mask)) and File_Access_Permission_Bits); end Set_Allowed_Process_Permissions; end POSIX.Permissions; florist-gpl-2017-src/libsrc/posix-user_database.adb0000644000076700001450000001336613106553472021716 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . U S E R _ D A T A B A S E -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation, Unchecked_Conversion; package body POSIX.User_Database is use POSIX.C; use POSIX.Implementation; function To_uid_t is new Unchecked_Conversion (POSIX_Process_Identification.User_ID, uid_t); function To_User_ID is new Unchecked_Conversion (uid_t, POSIX_Process_Identification.User_ID); function To_Group_ID is new Unchecked_Conversion (gid_t, POSIX_Process_Identification.Group_ID); -------------------- -- User_Name_Of -- -------------------- function User_Name_Of (DB_Item : User_Database_Item) return POSIX.POSIX_String is begin return Form_POSIX_String (DB_Item.pw_name); end User_Name_Of; ------------------ -- User_ID_Of -- ------------------ function User_ID_Of (DB_Item : User_Database_Item) return POSIX_Process_Identification.User_ID is begin return To_User_ID (DB_Item.pw_uid); end User_ID_Of; ------------------- -- Group_ID_Of -- ------------------- function Group_ID_Of (DB_Item : User_Database_Item) return POSIX_Process_Identification.Group_ID is begin return To_Group_ID (DB_Item.pw_gid); end Group_ID_Of; ---------------------------- -- Initial_Directory_Of -- ---------------------------- function Initial_Directory_Of (DB_Item : User_Database_Item) return POSIX.POSIX_String is begin return Form_POSIX_String (DB_Item.pw_dir); end Initial_Directory_Of; -------------------------- -- Initial_Program_Of -- -------------------------- function Initial_Program_Of (DB_Item : User_Database_Item) return POSIX.POSIX_String is begin return Form_POSIX_String (DB_Item.pw_shell); end Initial_Program_Of; ------------------------------ -- Get_User_Database_Item -- ------------------------------ function getpwuid (c_uid : uid_t) return passwd_ptr; pragma Import (C, getpwuid, getpwuid_LINKNAME); function Get_User_Database_Item (UID : POSIX_Process_Identification.User_ID) return User_Database_Item is Result : passwd_ptr; begin Result := getpwuid (To_uid_t (UID)); if Result = null then Raise_POSIX_Error; end if; return User_Database_Item (Result); end Get_User_Database_Item; ------------------------------ -- Get_User_Database_Item -- ------------------------------ function getpwnam (c_name : char_ptr) return passwd_ptr; pragma Import (C, getpwnam, getpwnam_LINKNAME); function Get_User_Database_Item (Name : POSIX_String) return User_Database_Item is Result : passwd_ptr; Name_With_NUL : POSIX_String := Name & NUL; begin Result := getpwnam (Name_With_NUL (Name_With_NUL'First)'Unchecked_Access); if Result = null then Raise_POSIX_Error; end if; return User_Database_Item (Result); end Get_User_Database_Item; end POSIX.User_Database; florist-gpl-2017-src/libsrc/posix_c.ads0000644000076700001450000000537513106553472017442 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ C -- -- -- -- S p e c -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.C; package POSIX_C renames POSIX.C; florist-gpl-2017-src/libsrc/posix-process_environment.adb0000644000076700001450000006603313106553472023215 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P R O C E S S _ E N V I R O N M E N T -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5 : 1990 and IEEE STD -- -- 1003.5b : 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with Ada.Command_Line, POSIX.C, POSIX.Implementation, Unchecked_Deallocation; package body POSIX.Process_Environment is use POSIX.C; use POSIX.Implementation; type Environment_List is new POSIX.Implementation.String_List; type var_char_ptr_ptr is access all char_ptr; pragma Warnings (Off); function To_Variable is new Unchecked_Conversion (char_ptr_ptr, var_char_ptr_ptr); pragma Warnings (On); procedure Free is new Unchecked_Deallocation (POSIX_String, POSIX_String_Ptr); --------------------------------------- -- Interfaced C String Subprograms -- --------------------------------------- function strlen (str : char_ptr) return size_t; pragma Import (C, strlen, "strlen"); function strcpy (dest : char_ptr; src : char_ptr) return char_ptr; pragma Import (C, strcpy, "strcpy"); function strcat (dest : char_ptr; src : char_ptr) return char_ptr; pragma Import (C, strcat, "strcat"); function strncat (dest : char_ptr; src : char_ptr; n : size_t) return char_ptr; pragma Import (C, strncat, "strncat"); ---------------------------------------------------------- -- Interfaced C Environment Subprograms and Variables -- ---------------------------------------------------------- environ : char_ptr_ptr; pragma Import (C, environ, "environ"); function c_setenv (name : char_ptr; value : char_ptr; overwrite : int) return int; pragma Import (C, c_setenv, setenv_LINKNAME); function c_getenv (name : char_ptr) return char_ptr; pragma Import (C, c_getenv, getenv_LINKNAME); function c_putenv (pair : char_ptr) return int; -- This creates a potentially permanent reference; the -- storage pointed to by pair must not be recovered! pragma Import (C, c_putenv, putenv_LINKNAME); function c_unsetenv (name : char_ptr) return int; pragma Import (C, c_unsetenv, unsetenv_LINKNAME); ------------------------- -- Local_Subprograms -- ------------------------- procedure Validate (Name : POSIX_String); -- Verify that a name is legal, raising posix_error otherwise. function Split_Point (Str : POSIX_String) return Natural; -- Return location of first "=" in string, -- or zero if no "=" is found. -- Assume the string is NUL terminated. function Match (Pair : POSIX_String_Ptr; Name : POSIX_String) return Natural; -- Match returns zero unless Pair has the form -- Name & '=' & ..., in which case it returns the index -- immediately following the '=' in Pair. -- The following C-style version of Match is used -- only if the environment does not provide one or more -- of the standard functions putenv, setenv, getenv, unsetenv. function C_Match (Pair : char_ptr; Name : char_ptr) return char_ptr; -- If the C environment has the standard functions to modify -- the environment, we use those. Otherwise, we hack our own. function Setenv (Name : char_ptr; Value : char_ptr; Overwrite : int) return int; function Unsetenv (Name : char_ptr) return int; function Getenv (Name : char_ptr) return char_ptr; function Create_Pair (Name, Value : char_ptr) return char_ptr; ------------------- -- Create_Pair -- ------------------- function Create_Pair (Name, Value : char_ptr) return char_ptr is Tmp : char_ptr; Eqls : aliased constant POSIX_String := "="; begin Tmp := malloc (strlen (Name) + strlen (Value) + 2); Tmp := strcpy (Tmp, Name); Tmp := strncat (Tmp, Eqls (1)'Unchecked_Access, 1); Tmp := strcat (Tmp, Value); return Tmp; end Create_Pair; -------------- -- Setenv -- -------------- function Setenv (Name : char_ptr; Value : char_ptr; Overwrite : int) return int is begin if HAVE_putenv then if Overwrite = 0 and then c_getenv (Name) /= null then return 0; end if; return c_putenv (Create_Pair (Name, Value)); elsif HAVE_setenv then return c_setenv (Name, Value, Overwrite); else declare P : char_ptr_ptr := environ; PP : char_ptr_ptr; T : char_ptr_ptr; K : size_t := 0; begin while P.all /= null loop if C_Match (P.all, Name) /= null then if Overwrite = 0 then return 0; end if; -- don't risk freeing P.all! To_Variable (P).all := Create_Pair (Name, Value); end if; K := K + 1; Advance (P); end loop; PP := malloc ((K + 2) * (char_ptr'Size / char'Size)); T := PP; P := environ; for I in 1 .. K loop To_Variable (T).all := P.all; Advance (T); Advance (P); end loop; To_Variable (T).all := Create_Pair (Name, Value); Advance (T); To_Variable (T).all := null; environ := PP; -- .... this risks storage leakage (see note above) end; return 0; end if; end Setenv; ---------------- -- Unsetenv -- ---------------- function Unsetenv (Name : char_ptr) return int is begin if HAVE_unsetenv then return c_unsetenv (Name); else declare P : char_ptr_ptr := environ; PP : char_ptr_ptr; Q : char_ptr; begin while P.all /= null loop Q := C_Match (P.all, Name); if Q /= null then loop PP := P; Advance (P); To_Variable (PP).all := P.all; if P.all = null then return 0; end if; end loop; end if; Advance (P); end loop; end; return 0; end if; end Unsetenv; -------------- -- Getenv -- -------------- function Getenv (Name : char_ptr) return char_ptr is begin if HAVE_getenv then return c_getenv (Name); else declare P : char_ptr_ptr := environ; Q : char_ptr; begin while P.all /= null loop Q := C_Match (P.all, Name); if Q /= null then return Q; end if; Advance (P); end loop; end; end if; return null; end Getenv; ---------------- -- Validate -- ---------------- procedure Validate (Name : POSIX_String) is begin if Name = "" then Raise_POSIX_Error (Invalid_Argument); end if; for P in Name'Range loop if Name (P) = '=' or Name (P) = NUL then Raise_POSIX_Error (Invalid_Argument); end if; end loop; end Validate; ------------------- -- Split_Point -- ------------------- function Split_Point (Str : POSIX_String) return Natural is begin for J in Str'Range loop if Str (J) = '=' then return J; end if; if Str (J) = NUL then return 0; end if; end loop; return 0; end Split_Point; ------------- -- Match -- ------------- function Match (Pair : POSIX_String_Ptr; Name : POSIX_String) return Natural is J, JL, K, KL : Integer; begin J := Pair'First; K := Name'First; JL := Pair'Last; KL := Name'Last; while (J <= JL and K <= KL) and then Pair (J) = Name (K) loop J := J + 1; K := K + 1; end loop; -- J > JL or K > KL or Pair (J) /= Name (K) if (K > KL and J <= JL) and then Pair (J) = '=' then return J + 1; end if; return 0; end Match; function C_Match (Pair : char_ptr; Name : char_ptr) return char_ptr is J, K : char_ptr; begin J := Pair; K := Name; while (J.all /= NUL and K.all /= NUL) and then J.all = K.all loop Advance (J); Advance (K); end loop; -- J.all = NUL or K.all = NUL or J.all /= K.all if K.all = NUL and J.all = '=' then Advance (J); return J; end if; return null; end C_Match; -------------------------- -- Current Environment -- -------------------------- -- .... Change P1003.5? -- It is not clear from P1003.5 whether the current environment -- should be shared between Ada and C code. We assume that -- it should be shared, and therefore we use the C-language -- operations to access the current environment. -- P1003.5 says we need to recover the storage of the old value -- of the current environment when we modify it. We must trust -- the C interface to do it, if we want compatibility. -- We choose not to try to make these operations tasking-safe, -- as it is not required by the standard and there is no way -- we can make the C interfaces tasking safe. -- .... consider trying to reduce storage leakage here -- Suppose every string that we allocate to become part of the current -- environment is actually part of a record, with a pointer field -- that is used to keep a linked list of all such records. -- When we change an environment value we could run down the list -- and if the string is found, we could safely recover the storage. -- Of course, for this to be safe for concurrent usage, we would need -- to make the operations that modify the list into critical sections. -- Similarly, we could reduce storage leakage for the object corresponding -- to the current environment, when we need to grow it, in Setenv. -- For example, we might declare : -- Our_Environ : char_ptr_ptr := null; -- Points to the last storage we malloced and used for C's environ. -- Our_Environ_Length : Integer := -1; -- The length in pointers of Our_Environ, if that is not null. -- When we shrink the environment, we could remember that there is -- extra space, using Our_Environ_Length, so that when we need to -- grow it again we would not need to allocate a new block. -- When we need to allocate a larger block, we could recover the -- old one, if environ = Our_Environ. --------------------- -- Argument_List -- --------------------- function Argument_List return POSIX.POSIX_String_List is use Ada.Command_Line; Argv : POSIX_String_List; begin Append (Argv, To_POSIX_String (Command_Name)); for I in 1 .. Argument_Count loop Append (Argv, To_POSIX_String (Argument (I))); end loop; return Argv; end Argument_List; -- .... Consider rewriting the above to use the direct C interface. -- That is, get rid of the extra string copying and type conversion. ------------------------------------- -- Copy_From_Current_Environment -- ------------------------------------- procedure Copy_From_Current_Environment (Env : in out Environment) is P : char_ptr_ptr := environ; Tmp : POSIX_String_List := To_POSIX_String_List (Env); begin if P /= null then while P.all /= null loop -- .... concise but inefficient -- We first remove the NUL and then reappend it. Append (Tmp, Form_POSIX_String (P.all)); Advance (P); end loop; end if; Env := To_Environment (Tmp); end Copy_From_Current_Environment; ----------------------------------- -- Copy_To_Current_Environment -- ----------------------------------- procedure Copy_To_Current_Environment (Env : Environment) is procedure Copy_One (Name : POSIX_String; Value : POSIX_String; Quit : in out Boolean); procedure Copy_One (Name : POSIX_String; Value : POSIX_String; Quit : in out Boolean) is pragma Warnings (Off, Quit); begin Set_Environment_Variable (Name, Value); end Copy_One; procedure Copy_All is new For_Every_Environment_Variable (Copy_One); -- .... concise but inefficient -- We split up pairs, and recombine them, -- adding and removing NUL along the way. -- If we could count on having putenv(), -- the splitting and recombining could be avoided. begin Clear_Environment; Copy_All (Env); end Copy_To_Current_Environment; ------------------------ -- Copy_Environment -- ------------------------ procedure Copy_Environment (Source : Environment; Target : in out Environment) is T_Source : constant POSIX_String_List := To_POSIX_String_List (Source); T_Target : POSIX_String_List; procedure Copy_One (Str : POSIX_String; Done : in out Boolean); procedure Copy_One (Str : POSIX_String; Done : in out Boolean) is pragma Warnings (Off, Done); begin Append (T_Target, Str); end Copy_One; procedure Copy_All is new For_Every_Item (Copy_One); begin Clear_Environment (Target); Copy_All (T_Source); Target := To_Environment (T_Target); end Copy_Environment; ---------------------------- -- Environment_Value_Of -- ---------------------------- function Environment_Value_Of (Name : POSIX.POSIX_String; Env : Environment; Undefined : POSIX.POSIX_String := "") return POSIX.POSIX_String is J : Integer; begin Validate (Name); if Env /= null then for I in 1 .. Env.Length loop exit when Env.List (I) = null; J := Match (Env.List (I), Name); if J /= 0 then return Form_POSIX_String (Env.List (I)(J)'Unchecked_Access); end if; end loop; end if; return Undefined; end Environment_Value_Of; ---------------------------- -- Environment_Value_Of -- ---------------------------- function Environment_Value_Of (Name : POSIX.POSIX_String; Undefined : POSIX.POSIX_String := "") return POSIX.POSIX_String is c_name : POSIX_String := Name & NUL; Result : constant char_ptr := Getenv (c_name (c_name'First)'Unchecked_Access); begin Validate (Name); if Result = null then return Undefined; end if; return Form_POSIX_String (Result); end Environment_Value_Of; ------------------------------- -- Is_Environment_Variable -- ------------------------------- function Is_Environment_Variable (Name : POSIX.POSIX_String; Env : Environment) return Boolean is Result : Boolean := False; procedure Check (Name : POSIX_String; Value : POSIX_String; Done : in out Boolean); procedure Check (Name : POSIX_String; Value : POSIX_String; Done : in out Boolean) is pragma Warnings (Off, Value); begin if Name = Is_Environment_Variable.Name then Result := True; Done := True; end if; end Check; procedure Check_All is new For_Every_Environment_Variable (Check); begin Validate (Name); Check_All (Env); return Result; end Is_Environment_Variable; ------------------------------- -- Is_Environment_Variable -- ------------------------------- function Is_Environment_Variable (Name : POSIX.POSIX_String) return Boolean is c_name : POSIX_String := Name & NUL; begin Validate (Name); return Getenv (c_name (c_name'First)'Unchecked_Access) /= null; end Is_Environment_Variable; ------------------------- -- Clear_Environment -- ------------------------- procedure Clear_Environment (Env : in out Environment) is Tmp : POSIX_String_List := To_POSIX_String_List (Env); begin Make_Empty (Tmp); Env := To_Environment (Tmp); end Clear_Environment; ------------------------- -- Clear_Environment -- ------------------------- procedure Clear_Environment is P : char_ptr_ptr := environ; Strings : POSIX_String_List; procedure Clear_One (Str : POSIX_String; Done : in out Boolean); procedure Clear_One (Str : POSIX_String; Done : in out Boolean) is pragma Warnings (Off, Done); begin Check (Unsetenv (Str (Str'First)'Unchecked_Access)); end Clear_One; procedure Clear_All is new For_Every_Item (Clear_One); begin if P /= null then while P.all /= null loop -- .... concise but inefficient declare S : constant POSIX_String := Form_POSIX_String (P.all); J : constant Integer := Split_Point (S); begin Append (Strings, S (1 .. J - 1)); end; Advance (P); end loop; Clear_All (Strings); Make_Empty (Strings); P := environ; while P.all /= null loop Advance (P); end loop; end if; end Clear_Environment; -------------------------------- -- Set_Environment_Variable -- -------------------------------- procedure Set_Environment_Variable (Name : POSIX.POSIX_String; Value : POSIX.POSIX_String; Env : in out Environment) is J, L : Natural; Tmp : POSIX_String_List; begin Validate (Name); if Env /= null then L := 0; -- last empty location for I in 1 .. Env.Length loop if Env.List (I) = null then if L = 0 then L := I; end if; exit; end if; J := Match (Env.List (I), Name); if J /= 0 then Free (Env.List (I)); Env.List (I) := new POSIX_String'(Name & "=" & Value & NUL); Env.Char (I) := Env.List (I)(1)'Unchecked_Access; return; end if; end loop; pragma Assert (L /= 0); if L < Env.Length then Env.List (L) := new POSIX_String'(Name & "=" & Value & NUL); Env.Char (L) := Env.List (L)(1)'Unchecked_Access; return; end if; end if; Tmp := To_POSIX_String_List (Env); Append (Tmp, Name & "=" & Value); Env := To_Environment (Tmp); end Set_Environment_Variable; -------------------------------- -- Set_Environment_Variable -- -------------------------------- procedure Set_Environment_Variable (Name : POSIX.POSIX_String; Value : POSIX.POSIX_String) is c_name : POSIX_String := Name & NUL; c_value : POSIX_String := Value & NUL; begin Validate (Name); Check (Setenv (c_name (c_name'First)'Unchecked_Access, c_value (c_value'First)'Unchecked_Access, 1)); end Set_Environment_Variable; ----------------------------------- -- Delete_Environment_Variable -- ----------------------------------- procedure Delete_Environment_Variable (Name : POSIX.POSIX_String; Env : in out Environment) is K : Natural; -- the location where Env.List (I) should be; -- eventually lags behind I if we have deleted something begin Validate (Name); if Env /= null then K := 1; for I in 1 .. Env.Length loop -- copy Ith pair down, if necessary -- to fill in for deleted pair if K /= I then Env.List (K) := Env.List (I); Env.Char (K) := Env.Char (I); Env.List (I) := null; Env.Char (I) := null; end if; exit when Env.List (K) = null; if Match (Env.List (K), Name) /= 0 then Free (Env.List (K)); Env.Char (K) := null; else K := K + 1; end if; end loop; end if; end Delete_Environment_Variable; ----------------------------------- -- Delete_Environment_Variable -- ----------------------------------- procedure Delete_Environment_Variable (Name : POSIX.POSIX_String) is c_name : POSIX_String := Name & NUL; begin Validate (Name); Check (Unsetenv (c_name (c_name'First)'Unchecked_Access)); end Delete_Environment_Variable; -------------- -- Length -- -------------- function Length (Env : Environment) return Natural is begin return Length (To_POSIX_String_List (Env)); end Length; -------------- -- Length -- -------------- function Length return Natural is P : char_ptr_ptr := environ; L : Natural := 0; begin if P /= null then while P.all /= null loop L := L + 1; Advance (P); end loop; end if; return L; end Length; -------------------------------------- -- For_Every_Environment_Variable -- -------------------------------------- -- .... Should we try to protect against side-effects of Action? -- We can do this by making a temporary local copy of the -- environment, to use in the traversal. The cost is the overhead -- of making this copy. We currently choose not to do this, -- though it means cannot use For_Every_Environment_Variable to implement -- Clear_Environment. procedure For_Every_Environment_Variable (Env : Environment) is Quit : Boolean := False; begin if Env = null then return; end if; for I in 1 .. Env.Length loop exit when Env.List (I) = null; declare L : constant Integer := Env.List (I)'Length; J : constant Integer := Split_Point (Env.List (I).all); begin if J /= 0 then if J < L then declare Value : constant POSIX_String (1 .. L - (J + 1)) := Env.List (I)(J + 1 .. L - 1); -- contortion needed so index range starts with 1 begin Action (Env.List (I)(1 .. J - 1), Value, Quit); end; else Action (Env.List (I)(1 .. J - 1), "", Quit); end if; end if; end; exit when Quit; end loop; end For_Every_Environment_Variable; ---------------------------------------------- -- For_Every_Current_Environment_Variable -- ---------------------------------------------- procedure For_Every_Current_Environment_Variable is Quit : Boolean := False; P : char_ptr_ptr := environ; begin if P = null then return; end if; while P.all /= null loop declare Str : POSIX_String := Form_POSIX_String (P.all); I : constant Natural := Split_Point (Str); begin if I /= 0 then Str (I) := NUL; Action (Str (1 .. I - 1), Str (I + 1 .. Str'Last), Quit); end if; end; exit when Quit; Advance (P); end loop; end For_Every_Current_Environment_Variable; -------------------------------- -- Change_Working_Directory -- -------------------------------- procedure Change_Working_Directory (Directory_Name : POSIX.Pathname) is function chdir (path : char_ptr) return int; pragma Import (C, chdir, chdir_LINKNAME); c_name : POSIX_String := Directory_Name & NUL; begin Check (chdir (c_name (c_name'First)'Unchecked_Access)); end Change_Working_Directory; ----------------------------- -- Get_Working_Directory -- ----------------------------- function Get_Working_Directory return POSIX.Pathname is function getcwd (buf : char_ptr; size : size_t) return char_ptr; pragma Import (C, getcwd, getcwd_LINKNAME); Guessed_Length : Positive := 256; Result : char_ptr; begin loop declare Buf : POSIX_String (1 .. Guessed_Length); begin Result := getcwd (Buf (1)'Unchecked_Access, size_t (Guessed_Length)); if Result /= null then return Form_POSIX_String (Result); end if; end; exit when Fetch_Errno /= ERANGE; Guessed_Length := Guessed_Length * 2; end loop; Raise_POSIX_Error; return ""; -- to suppress compiler warning end Get_Working_Directory; end POSIX.Process_Environment; florist-gpl-2017-src/libsrc/posix-file_status-extensions.adb0000644000076700001450000000651613106553472023632 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . F I L E _ S T A T U S . E X T E N S I O N S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.C; use POSIX.C; package body POSIX.File_Status.Extensions is ------------------------ -- IO_Block_Size_Of -- ------------------------ function IO_Block_Size_Of (File_Status : Status) return POSIX.IO_Count is begin return IO_Count (struct_stat (File_Status).st_blksize); end IO_Block_Size_Of; --------------------------- -- Allocated_Blocks_Of -- --------------------------- function Allocated_Blocks_Of (File_Status : Status) return POSIX.IO_Count is begin return IO_Count (struct_stat (File_Status).st_blocks); end Allocated_Blocks_Of; end POSIX.File_Status.Extensions; florist-gpl-2017-src/libsrc/posix_calendar.ads0000644000076700001450000000572713106553472020772 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ C A L E N D A R -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 1991-1994 Florida State University -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Calendar; pragma Elaborate_All (POSIX.Calendar); package POSIX_Calendar renames POSIX.Calendar; florist-gpl-2017-src/libsrc/posix_page_alignment.ads0000644000076700001450000000564013106553472022165 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ P A G E _ A L I G N M E N T -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Page_Alignment; pragma Elaborate_All (POSIX.Page_Alignment); package POSIX_Page_Alignment renames POSIX.Page_Alignment; florist-gpl-2017-src/libsrc/posix-implementation.ads0000644000076700001450000003641113106553472022156 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . I M P L E M E N T A T I O N -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996-1999 Florida State University (FSU). All Rights -- -- Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.C, System.Interrupt_Management, Unchecked_Conversion; package POSIX.Implementation is pragma Elaborate_Body; -- ========= -- -- WARNING -- -- ========= -- -- This package should NOT be used directly by an application. -- It is internal to the FLORIST implementation of the POSIX.5 API, -- and may be changed or replaced in future versions of FLORIST. ------------------------- -- Critical Sections -- ------------------------- -- NEVER raise an exception within a critical section -- or abort-deferred section! -- Not even indirectly, by calling a subprogram -- that might raise an exception. -- Always exit the section, then raise the exception. -- ALWAYS enclose critical sections in a block with an -- exception handler that will call End_Critical_Section -- before allowing the exception to propagate, unless you -- can prove that no exception will be raised in the code. -- (How about Storage_Error, due to stack overflow?) -- Try to avoid nesting critical sections, -- as it means extra overhead. procedure Defer_Abortion; procedure Undefer_Abortion; -- The following two also defer/undefer abort, as side-effects. procedure Begin_Critical_Section; procedure End_Critical_Section; -------------- -- Checks -- -------------- -- Don't ever call any of these within a critical section, -- or within an abort-deferred section! subtype Signal_Mask is System.Interrupt_Management.Interrupt_Mask; type Signal_Mask_Access is access all Signal_Mask; procedure Raise_POSIX_Error (Error : Error_Code := No_Error); pragma No_Return (Raise_POSIX_Error); procedure Check (Condition : Boolean; Error : Error_Code; Old_Mask : Signal_Mask_Access := null); -- if Condition is false, raise POSIX_Error with -- specified error code, else just return -- -- If Old_Mask /= null, then on failure call Restore_Signals with -- that mask before raising POSIX_Error. procedure Check (Result : POSIX.C.int; Old_Mask : Signal_Mask_Access := null); function Check (Result : POSIX.C.int; Old_Mask : Signal_Mask_Access := null) return POSIX.C.int; -- if Result is -1 raise POSIX_Error with current error code -- otherwise just return Result. -- -- If Old_Mask /= null, then call Restore_Signals with that mask -- before raising POSIX_Error. procedure Check_NNeg (Result : POSIX.C.int); function Check_NNeg (Result : POSIX.C.int) return POSIX.C.int; -- same as Check, except any negative value is treated -- as a failure -- pragma Inline (Check); procedure Check_NZ (Result : POSIX.C.int); -- same as Check, except any nonzero value is an error code -- pragma Inline (Check); function Not_Implemented_Neg_One return POSIX.C.int; -- return -1 with error code ENOSYS pragma Export (C, Not_Implemented_Neg_One, "nosys_neg_one"); function Not_Implemented_Direct return POSIX.C.int; -- return error code ENOSYS pragma Export (C, Not_Implemented_Direct, "nosys_direct"); function Not_Supported_Neg_One return POSIX.C.int; -- return -1 with error code ENOTSUP pragma Export (C, Not_Supported_Neg_One, "notsup_neg_one"); function Not_Supported_Direct return POSIX.C.int; -- return ENOTSUP pragma Export (C, Not_Supported_Direct, "notsup_direct"); -- These are used as stub link-names for C interface subprograms -- which are missing from the OS include-files. -- .... We still need to analyze all these functions, one by one, -- so that the code in c-posix.c initialized the corresponding ..._LINKNAME -- variable to the right value. -- If we have any calls to functions that may legitimately return -- a value of -1 for a non-error condition, we may need to add some -- special stubs for those functions. --------------- -- Strings -- --------------- NUL_String : POSIX_String := (1 => NUL); function Form_String (Str : POSIX.C.char_ptr) return String; function Trim_Leading_Blank (S : String) return String; -- pragma Inline (Trim_Leading_Blank); procedure Nulterminate (To : out POSIX_String; From : String); -------------------- -- String Lists -- -------------------- type POSIX_String_Ptr is access all POSIX_String; type PSP_Array is array (Positive range <>) of POSIX_String_Ptr; type String_List (Length : Natural) is record List : PSP_Array (1 .. Length); Char : POSIX.C.char_ptr_array (1 .. Length); -- X.Char(i) = X.List(i)(1)'Unchecked_access end record; type String_List_Ptr is access all String_List; -- No_Strict_Aliasing is necessary here to avoid potential -- optimization issues when making unchecked conversions to -- String_List_Ptr. pragma No_Strict_Aliasing (String_List_Ptr); Null_String_List : aliased String_List := (Length => 1, List => (1 => null), Char => (1 => null)); Null_String_List_Ptr : constant String_List_Ptr := Null_String_List'Access; -- We try to represent String_List in a form that does not -- require further conversion to pass it to the C interface. -- The main problem is that Ada strings carry along "dope" -- (including index range info) which will confuse a C subprogram, -- but which is needed for proper storage deallocation. -- We'd like to simply use char_ptr_ptr, but that does not -- give us the length information we need to do storage -- deallocation. Likewise, for the component strings, we -- can't just use char_ptr, since that does not carry along -- the length information we will need later. In principle, -- we could take advantage of compiler-dependent information -- about how arrays are laid out, including the location of -- dope, but then we'd have to change this code every time -- the compiler changes. Instead, we create a redundant -- data structure, that contains its own dope. -- Each element string must be null-terminated, as is -- the array of pointers Char. Thus, -- X.Length is not the virtual "length" of the list; -- that must be calculated, C-style, by counting positions -- until a null element is reached. -- We address the problem of predicting the length of -- array needed by blocking and recopying if necessary -- for the Append operation. -- For now, we guess the string length is 16, -- and double the length each time it overflows. -- On the average, this should result in fewer calls -- to malloc() than if we were to use a linked list. Min_String_List_Length : constant := 16; ---------------------- -- Signal Masking -- ---------------------- -- The following two also defer/undefer abortion, as side-effects. procedure Mask_Signals (Masking : Signal_Masking; Old_Mask : Signal_Mask_Access); procedure Restore_Signals (Masking : Signal_Masking; Old_Mask : Signal_Mask_Access); procedure Restore_Signals (Old_Mask : Signal_Mask_Access); -- The following are provided for exit from a critical -- section where error checking needs to be done. The issue -- here is that Restore_Signals may change the value of errno, -- so we need to combine the actions into one operation, -- saving the errno value over the call to Restore_Signals. procedure Restore_Signals_And_Raise_POSIX_Error (Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access); procedure Check_NNeg_And_Restore_Signals (Result : POSIX.C.int; Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access); ------------------- -- Error Codes -- ------------------- -- The following operate on the raw Pthread errno value, -- and must be written in C since errno may be accessed via -- a macro. function Fetch_Errno return Error_Code; pragma Import (C, Fetch_Errno, "fetch_errno"); procedure Store_Errno (value : Error_Code); pragma Import (C, Store_Errno, "store_errno"); -- The following operate on the Ada per-task errno value. -- The difference is that this value is not affected by any -- implicit OS calls that might occur during the implementation -- of exception propagation. function Get_Ada_Error_Code return Error_Code; procedure Set_Ada_Error_Code (Error : Error_Code); package Bogus_Error_Codes is -- These names are enclosed in this inner -- package to avoid name conflicts -- with the real error code constants, which are -- exported by this package. type Error_Name_Enum is (No_Error, Argument_List_Too_Long, Bad_Address, Bad_File_Descriptor, Bad_Message, Broken_Pipe, Directory_Not_Empty, Exec_Format_Error, File_Exists, File_Too_Large, Filename_Too_Long, Improper_Link, Inappropriate_IO_Control_Operation, Input_Output_Error, Interrupted_Operation, Invalid_Argument, Invalid_Seek, Is_A_Directory, Message_Too_Long, No_Child_Process, No_Locks_Available, No_Space_Left_On_Device, No_Such_Operation_On_Device, No_Such_Device_Or_Address, No_Such_File_Or_Directory, No_Such_Process, Not_A_Directory, Not_Enough_Space, Operation_Canceled, Operation_In_Progress, Operation_Not_Implemented, Operation_Not_Permitted, Operation_Not_Supported, Permission_Denied, Read_Only_File_System, Resource_Busy, Resource_Deadlock_Avoided, Resource_Temporarily_Unavailable, Timed_Out, Too_Many_Links, Too_Many_Open_Files, Too_Many_Open_Files_In_System, -- 2.4.6 Socket Error Codes from P1003.5c Address_In_Use, Address_Not_Available, Already_Awaiting_Connection, Connection_Aborted, Connection_Refused, Connection_Reset, Domain_Error, Host_Down, Host_Unreachable, Inappropriate_Family, Is_Already_Connected, Network_Down, Network_Reset, Network_Unreachable, No_Buffer_Space, Not_A_Socket, Not_Connected, Option_Not_Supported, Protocol_Not_Supported, Socket_Not_Supported, Unknown_Protocol_Option, Would_Block, Wrong_Protocol_Type); type Error_Array_Type is array (Error_Name_Enum) of Error_Code; end Bogus_Error_Codes; Error_Array : constant Bogus_Error_Codes.Error_Array_Type := (No_Error, E2BIG, EFAULT, EBADF, EBADMSG, EPIPE, ENOTEMPTY, ENOEXEC, EEXIST, EFBIG, ENAMETOOLONG, EXDEV, ENOTTY, EIO, EINTR, EINVAL, ESPIPE, EISDIR, EMSGSIZE, ECHILD, ENOLCK, ENOSPC, ENODEV, ENXIO, ENOENT, ESRCH, ENOTDIR, ENOMEM, ECANCELED, EINPROGRESS, ENOSYS, EPERM, ENOTSUP, EACCES, EROFS, EBUSY, EDEADLK, EAGAIN, ETIMEDOUT, EMLINK, EMFILE, ENFILE, -- 2.4.6 Socket Error Codes from P1003.5c EADDRINUSE, EADDRNOTAVAIL, EALREADY, ECONNABORTED, ECONNREFUSED, ECONNRESET, EDOM, EHOSTDOWN, EHOSTUNREACH, EAFNOSUPPORT, EISCONN, ENETDOWN, ENETRESET, ENETUNREACH, ENOBUFS, ENOTSOCK, ENOTCONN, EOPNOTSUPP, EPROTONOSUPPORT, ESOCKTNOSUPPORT, ENOPROTOOPT, EWOULDBLOCK, EPROTOTYPE); ------------------------ -- Time Conversions -- ------------------------ NS_per_S : constant := 10#1#E9; MS_per_S : constant := 10#1#E6; type D_Int is mod 2 ** (Duration'Size); function To_D_Int is new Unchecked_Conversion (Duration, D_Int); function To_Duration is new Unchecked_Conversion (D_Int, Duration); Duration_Delta_Assertion : constant := Boolean'Pos (Boolean'Pred (Duration'Small = 0.000_000_001)); -- We rely that POSIX.Calendar.Time and Calendar.Time are -- implemented using the same representation as Duration, and -- both are implemented using a UNIX clock. function To_Struct_Timespec (D : Duration) return POSIX.C.struct_timespec; function To_Struct_Timespec (T : Timespec) return POSIX.C.struct_timespec; function To_Duration (TS : POSIX.C.struct_timespec) return Duration; function To_Timespec (TS : POSIX.C.struct_timespec) return Timespec; function To_Struct_Timeval (D : Duration) return POSIX.C.struct_timeval; function To_Duration (TV : POSIX.C.struct_timeval) return Duration; end POSIX.Implementation; florist-gpl-2017-src/libsrc/posix-permissions-implementation.adb0000644000076700001450000001266213106553472024510 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P E R M I S S I O N S . I M P L E M E N T A T I O N -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1991-1994 Florida State University -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ package body POSIX.Permissions.Implementation is ------------------- -- Permissions -- ------------------- function Form_C_Permission (perm : Permission_Set) return mode_t is c_perm : mode_t; begin c_perm := 0; if perm (Others_Execute) then c_perm := c_perm or S_IXOTH; end if; if perm (Others_Write) then c_perm := c_perm or S_IWOTH; end if; if perm (Others_Read) then c_perm := c_perm or S_IROTH; end if; if perm (Group_Execute) then c_perm := c_perm or S_IXGRP; end if; if perm (Group_Write) then c_perm := c_perm or S_IWGRP; end if; if perm (Group_Read) then c_perm := c_perm or S_IRGRP; end if; if perm (Owner_Execute) then c_perm := c_perm or S_IXUSR; end if; if perm (Owner_Write) then c_perm := c_perm or S_IWUSR; end if; if perm (Owner_Read) then c_perm := c_perm or S_IRUSR; end if; if perm (Set_User_ID) then c_perm := c_perm or S_ISUID; end if; if perm (Set_Group_ID) then c_perm := c_perm or S_ISGID; end if; return c_perm; end Form_C_Permission; ----------------------------- -- form_posix_permission -- ----------------------------- function Form_Ada_Permission (perm : mode_t) return Permission_Set is a_perm : Permission_Set := (others => False); c_perm : mode_t; begin c_perm := perm; if (c_perm and S_IXOTH) /= 0 then a_perm (Others_Execute) := True; end if; if (c_perm and S_IWOTH) /= 0 then a_perm (Others_Write) := True; end if; if (c_perm and S_IROTH) /= 0 then a_perm (Others_Read) := True; end if; if (c_perm and S_IXGRP) /= 0 then a_perm (Group_Execute) := True; end if; if (c_perm and S_IWGRP) /= 0 then a_perm (Group_Write) := True; end if; if (c_perm and S_IRGRP) /= 0 then a_perm (Group_Read) := True; end if; if (c_perm and S_IXUSR) /= 0 then a_perm (Owner_Execute) := True; end if; if (c_perm and S_IWUSR) /= 0 then a_perm (Owner_Write) := True; end if; if (c_perm and S_IRUSR) /= 0 then a_perm (Owner_Read) := True; end if; if (c_perm and S_ISGID) /= 0 then a_perm (Set_Group_ID) := True; end if; if (c_perm and S_ISUID) /= 0 then a_perm (Set_User_ID) := True; end if; return a_perm; end Form_Ada_Permission; end POSIX.Permissions.Implementation; florist-gpl-2017-src/libsrc/posix-group_database.adb0000644000076700001450000001462513106553472022073 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . G R O U P _ D A T A B A S E -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation, Unchecked_Conversion; package body POSIX.Group_Database is use POSIX.C, POSIX.Implementation; function To_gid is new Unchecked_Conversion (POSIX.Process_Identification.Group_ID, gid_t); function To_Group_ID is new Unchecked_Conversion (gid_t, POSIX.Process_Identification.Group_ID); -- Operations to get information from a Group_Database_Item --------------------- -- Group_Name_Of -- --------------------- function Group_Name_Of (DB_Item : Group_Database_Item) return POSIX.POSIX_String is begin if DB_Item = null then Raise_POSIX_Error (Invalid_Argument); end if; return Form_POSIX_String (group_ptr (DB_Item).gr_name); end Group_Name_Of; ------------------- -- Group_ID_Of -- ------------------- function Group_ID_Of (DB_Item : Group_Database_Item) return POSIX.Process_Identification.Group_ID is begin if DB_Item = null then Raise_POSIX_Error (Invalid_Argument); end if; return To_Group_ID (group_ptr (DB_Item).gr_gid); end Group_ID_Of; ------------------------ -- Group_ID_List_Of -- ------------------------ function Group_ID_List_Of (DB_Item : Group_Database_Item) return Group_ID_List is begin if DB_Item = null then Raise_POSIX_Error (Invalid_Argument); end if; return Group_ID_List (group_ptr (DB_Item).gr_mem); end Group_ID_List_Of; ------------------------ -- For_Every_Member -- ------------------------ procedure For_Every_Member (List : Group_ID_List) is Quit : Boolean := False; P : char_ptr_ptr; begin P := char_ptr_ptr (List); if P = null then return; end if; while P.all /= null loop declare S : constant POSIX_String := Form_POSIX_String (P.all); begin Action (S, Quit); exit when Quit; end; Advance (P); end loop; end For_Every_Member; -------------- -- Length -- -------------- function Length (Member_List : Group_ID_List) return Natural is P : char_ptr_ptr := char_ptr_ptr (Member_List); Length : Natural := 0; begin if P = null then return 0; end if; while P.all /= null loop Length := Length + 1; Advance (P); end loop; return Length; end Length; ------------------------------- -- Get_Group_Database_Item -- ------------------------------- function getgrgid (gid : gid_t) return group_ptr; pragma Import (C, getgrgid, "getgrgid"); function getgrnam (name : char_ptr) return group_ptr; pragma Import (C, getgrnam, "getgrnam"); function Get_Group_Database_Item (GID : POSIX.Process_Identification.Group_ID) return Group_Database_Item is G : group_ptr; begin G := getgrgid (To_gid (GID)); if G = null then Raise_POSIX_Error (Invalid_Argument); end if; return Group_Database_Item (G); end Get_Group_Database_Item; ------------------------------- -- Get_Group_Database_Item -- ------------------------------- function Get_Group_Database_Item (Name : POSIX_String) return Group_Database_Item is Name_With_NUL : POSIX_String := Name & NUL; G : group_ptr; begin G := getgrnam (Name_With_NUL (Name_With_NUL'First)'Unchecked_Access); if G = null then Raise_POSIX_Error (Invalid_Argument); end if; return Group_Database_Item (G); end Get_Group_Database_Item; end POSIX.Group_Database; florist-gpl-2017-src/libsrc/posix-calendar.ads0000644000076700001450000001107513106553472020701 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . C A L E N D A R -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with Calendar, POSIX; package POSIX.Calendar is -- Time information type POSIX_Time is private; function Clock return POSIX_Time; function To_Time (Date : POSIX_Time) return Standard.Calendar.Time; function To_POSIX_Time (Date : Standard.Calendar.Time) return POSIX_Time; -- operations on POSIX_Time subtype Year_Number is Standard.Calendar.Year_Number; subtype Month_Number is Standard.Calendar.Month_Number; subtype Day_Number is Standard.Calendar.Day_Number; subtype Day_Duration is Standard.Calendar.Day_Duration; function Year (Date : POSIX_Time) return Year_Number; function Month (Date : POSIX_Time) return Month_Number; function Day (Date : POSIX_Time) return Day_Number; function Seconds (Date : POSIX_Time) return Day_Duration; procedure Split (Date : POSIX_Time; Year : out Year_Number; Month : out Month_Number; Day : out Day_Number; Seconds : out Day_Duration); function Time_Of (Year : Year_Number; Month : Month_Number; Day : Day_Number; Seconds : Day_Duration := 0.0) return POSIX_Time; function "+" (L : POSIX_Time; R : Duration) return POSIX_Time; function "+" (L : Duration; R : POSIX_Time) return POSIX_Time; function "-" (L : POSIX_Time; R : Duration) return POSIX_Time; function "-" (L : POSIX_Time; R : POSIX_Time) return Duration; function "<" (L, R : POSIX_Time) return Boolean; function "<=" (L, R : POSIX_Time) return Boolean; function ">" (L, R : POSIX_Time) return Boolean; function ">=" (L, R : POSIX_Time) return Boolean; Time_Error : exception renames Standard.Calendar.Time_Error; function To_POSIX_Time (Date : POSIX.Timespec) return POSIX_Time; function To_Timespec (Date : POSIX_Time) return POSIX.Timespec; private type POSIX_Time is new Standard.Calendar.Time; end POSIX.Calendar; florist-gpl-2017-src/libsrc/posix-process_identification.ads0000644000076700001450000001212113106553472023650 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P R O C E S S _ I D E N T I F I C A T I O N -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX.C; package POSIX.Process_Identification is -- Process Identification type Process_ID is private; Null_Process_ID : constant Process_ID; System_Process_ID : constant Process_ID; function Get_Process_ID return Process_ID; function Get_Parent_Process_ID return Process_ID; function Image (ID : Process_ID) return Standard.String; function Value (Str : Standard.String) return Process_ID; -- Process Group Identification type Process_Group_ID is private; function Get_Process_Group_ID return Process_Group_ID; procedure Set_Process_Group_ID (Process : Process_ID := Get_Process_ID; Process_Group : Process_Group_ID := Get_Process_Group_ID); procedure Create_Process_Group (Process : Process_ID; Process_Group : out Process_Group_ID); procedure Create_Session (Session_Leader : out Process_Group_ID); function Image (ID : Process_Group_ID) return Standard.String; function Value (Str : Standard.String) return Process_Group_ID; -- User Identification type User_ID is private; function Get_Real_User_ID return User_ID; function Get_Effective_User_ID return User_ID; procedure Set_User_ID (ID : User_ID); function Get_Login_Name return POSIX.POSIX_String; function Image (ID : User_ID) return Standard.String; function Value (Str : Standard.String) return User_ID; -- User Group Identification type Group_ID is private; function Get_Real_Group_ID return Group_ID; function Get_Effective_Group_ID return Group_ID; procedure Set_Group_ID (ID : Group_ID); subtype Group_List_Index is Positive range 1 .. POSIX.Groups_Maxima'Last; type Group_List is array (Group_List_Index range <>) of aliased Group_ID; -- ... Applications may not rely on "aliased" here being portable. -- We have added it to allow for simpler implementation. function Get_Groups return Group_List; function Image (ID : Group_ID) return Standard.String; function Value (Str : Standard.String) return Group_ID; private type Process_ID is new POSIX.C.pid_t; Null_Process_ID : constant Process_ID := 0; System_Process_ID : constant Process_ID := 1; -- The process ID value 1 is reserved for use by the system. type Process_Group_ID is new POSIX.C.pid_t; type User_ID is new POSIX.C.uid_t; type Group_ID is new POSIX.C.gid_t; end POSIX.Process_Identification; florist-gpl-2017-src/libsrc/posix-file_locking.ads0000644000076700001450000000730613106553472021557 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . F I L E _ L O C K I N G -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX, POSIX.IO, POSIX.Process_Identification; package POSIX.File_Locking is type Lock_Kind is (Read_Lock, Write_Lock, Unlock); type File_Lock (Whole_File : Boolean := True) is record Lock : Lock_Kind; case Whole_File is when True => null; when False => Starting_Point : POSIX.IO.Position; Start : POSIX.IO.IO_Offset; Length : POSIX.IO_Count; end case; end record; procedure Get_Lock (File : POSIX.IO.File_Descriptor; Lock : File_Lock; Result : out File_Lock; Process : out POSIX.Process_Identification.Process_ID); procedure Set_Lock (File : POSIX.IO.File_Descriptor; Lock : File_Lock); procedure Wait_To_Set_Lock (File : POSIX.IO.File_Descriptor; Lock : File_Lock; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); end POSIX.File_Locking; florist-gpl-2017-src/libsrc/posix-generic_shared_memory.ads0000644000076700001450000001116213106553472023457 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . G E N E R I C _ S H A R E D _ M E M O R Y -- -- -- -- S p e c -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2010, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ -- .... Change POSIX.5b???? -- ========== -- -- WARNINGS -- -- ========== -- -- 1) DO NOT instantiate this package for a controlled type. If you -- do, at best finalization will not work correctly. At worst, you -- will crash the entire process. -- 2) DO NOT instantiate and use Unchecked_Deallocation for the type -- Shared_Access belonging to an instantiation of this package. If -- you do, you are likely to end up corrupting the heap, and possibly -- crashing the entire process. with POSIX.IO, POSIX.Permissions, POSIX.Memory_Mapping; generic type Object_Type is private; -- Do not instantiate with a controlled type! -- See note below for reasons. package POSIX.Generic_Shared_Memory is type Shared_Access is access Object_Type; function Open_And_Map_Shared_Memory (Name : POSIX.POSIX_String; Protection : POSIX.Memory_Mapping.Protection_Options; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return POSIX.IO.File_Descriptor; function Open_Or_Create_And_Map_Shared_Memory (Name : POSIX.POSIX_String; Protection : POSIX.Memory_Mapping.Protection_Options; Permissions : POSIX.Permissions.Permission_Set; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return POSIX.IO.File_Descriptor; function Access_Shared_Memory (File : POSIX.IO.File_Descriptor) return Shared_Access; procedure Unmap_And_Close_Shared_Memory (File : POSIX.IO.File_Descriptor); procedure Lock_Shared_Memory (File : POSIX.IO.File_Descriptor); procedure Unlock_Shared_Memory (File : POSIX.IO.File_Descriptor); end POSIX.Generic_Shared_Memory; florist-gpl-2017-src/libsrc/posix_memory_range_locking.ads0000644000076700001450000000567013106553472023410 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ M E M O R Y _ R A N G E _ L O C K I N G -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Memory_Range_Locking; pragma Elaborate_All (POSIX.Memory_Range_Locking); package POSIX_Memory_Range_Locking renames POSIX.Memory_Range_Locking; florist-gpl-2017-src/libsrc/posix-macros.c0000644000076700001450000001414213106553473020066 0ustar gnatmailgnat/*---------------------------------------------------------------------------- -- -- -- FLORIST (FSU Implementation of POISX.5) COMPONENTS -- -- -- -- -- -- P O S I X - M A C R O S . C -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- Copyright (C) 1997-2010, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----------------------------------------------------------------------------*/ /* file: posix-macros.c -------------------- These subprograms provide access to POSIX functionality that is provided for C programs via macros. */ #define _REENTRANT #include "pconfig.h" #include #include #include #include #include #include /* This definition is need for multi-threaded error codes on Solaris */ int s_isdir(mode_t mode) { #ifdef S_ISDIR return S_ISDIR(mode); #else return -1; #endif } int s_ischr(mode_t mode) { #ifdef S_ISCHR return S_ISCHR(mode); #else return -1; #endif } int s_isblk(mode_t mode) { #ifdef S_ISBLK return S_ISBLK(mode); #else return -1; #endif } int s_isreg(mode_t mode) { #ifdef S_ISREG return S_ISREG(mode); #else return -1; #endif } int s_islnk(mode_t mode) { #ifdef S_ISLNK return S_ISLNK(mode); #else return -1; #endif } int s_issock(mode_t mode) { #ifdef S_ISSOCK return S_ISSOCK(mode); #else return -1; #endif } int s_isfifo(mode_t mode) { #ifdef S_ISFIFO return S_ISFIFO(mode); #else return -1; #endif } int s_ismsg(mode_t mode) { #ifdef S_ISMSG return S_ISMSG(mode); #else return -1; #endif } int s_typeismq(struct stat *p) { #ifdef S_TYPEISMQ return S_TYPEISMQ(p); #else return 0; #endif } int s_issem(mode_t mode) { #ifdef S_ISSEM return S_ISSEM(mode); #else return -1; #endif } int s_typeissem(struct stat *p) { #ifdef S_TYPEISSEM return S_TYPEISSEM(p); #else return 0; #endif } int s_isshm(mode_t mode) { #ifdef S_ISSHM return S_ISSHM(mode); #else return -1; #endif } int s_typeisshm(struct stat *p) { #ifdef S_TYPEISSHM return S_TYPEISSHM(p); #else return 0; #endif } int wifexited(int stat_val) { #ifdef WIFEXITED return WIFEXITED(stat_val); #else return -1; #endif } int wexitstatus(int stat_val) { #ifdef WEXITSTATUS return WEXITSTATUS(stat_val); #else return -1; #endif } int wifsignaled(int stat_val) { #ifdef WIFSIGNALED return WIFSIGNALED(stat_val); #else return -1; #endif } int wtermsig(int stat_val) { #ifdef WTERMSIG return WTERMSIG(stat_val); #else return -1; #endif } int wifstopped(int stat_val) { #ifdef WIFSTOPPED return WIFSTOPPED(stat_val); #else return -1; #endif } int wstopsig(int stat_val) { #ifdef WSTOPSIG return WSTOPSIG(stat_val); #else return -1; #endif } int fetch_errno() { return errno; } void store_errno(int value) { errno = value; } /* The following are variadic functions and on some platforms, for instance x86-64, calling a variadic function directly from Ada can cause problems. Here we provide wrappers that we import instead. */ int __gnat_florist_open(const char *path, int oflag, mode_t mode) { return open (path, oflag, mode); } sem_t *__gnat_florist_sem_open (char *name, int oflag, mode_t mode, unsigned value) { return sem_open (name, oflag, mode, value); } /* The following wrappers work around problems on systems where the stat family of functions are implemented using macros. (eg. Tru64 5.1A and Linux.) */ int __gnat_florist_stat(const char *path, struct stat *buf) { return stat(path, buf); } int __gnat_florist_lstat(const char *path, struct stat *buf) { return lstat(path, buf); } int __gnat_florist_fstat(int fd, struct stat *buf) { return fstat(fd, buf); } /* The following wrapper ensures that uname(3) is mapped correctly even when it is defined as an inlined function. */ int __gnat_florist_uname (struct utsname *s) { return uname (s); } florist-gpl-2017-src/libsrc/posix-process_identification.adb0000644000076700001450000002401313106553472023632 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P R O C E S S _ I D E N T I F I C A T I O N -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation; package body POSIX.Process_Identification is use POSIX.C, POSIX.Implementation; --------------------- -- Get_Process_ID -- --------------------- function getpid return pid_t; pragma Import (C, getpid, getpid_LINKNAME); function Get_Process_ID return Process_ID is begin return Process_ID (getpid); end Get_Process_ID; ----------------------------- -- Get_Parent_Process_ID -- ----------------------------- function Get_Parent_Process_ID return Process_ID is function getppid return pid_t; pragma Import (C, getppid, getppid_LINKNAME); begin return Process_ID (getppid); end Get_Parent_Process_ID; ----------- -- Image -- ----------- function Image (ID : Process_ID) return Standard.String is begin return Process_ID'Image (ID); end Image; ----------- -- Value -- ----------- function Value (Str : Standard.String) return Process_ID is begin return Process_ID'Value (Str); end Value; -------------------------- -- Get_Process_Group_ID -- -------------------------- -- The getpgrp takes an argument under BSD but not under POSIX. -- We pass it an argument in all cases and hope that the function -- call mechanism will not be confused by unexpected arguments. function getpgrp (ID : Process_ID) return Process_Group_ID; pragma Import (C, getpgrp, "getpgrp"); function Get_Process_Group_ID return Process_Group_ID is begin return getpgrp (Get_Process_ID); end Get_Process_Group_ID; -------------------------- -- Set_Process_Group_ID -- -------------------------- function setpgid (pid : pid_t; pgrp : pid_t) return int; pragma Import (C, setpgid, setpgid_LINKNAME); procedure Set_Process_Group_ID (Process : Process_ID := Get_Process_ID; Process_Group : Process_Group_ID := Get_Process_Group_ID) is begin Check (Process /= Null_Process_ID, Invalid_Argument); Check (setpgid (pid_t (Process), pid_t (Process_Group))); end Set_Process_Group_ID; -------------------------- -- Create_Process_Group -- -------------------------- procedure Create_Process_Group (Process : Process_ID; Process_Group : out Process_Group_ID) is function setpgid (pid : pid_t; pgrp : pid_t) return int; pragma Import (C, setpgid, setpgid_LINKNAME); begin Check (setpgid (pid_t (Process), 0)); Process_Group := Process_Group_ID (Process); end Create_Process_Group; ---------------------- -- Create_Session -- ---------------------- procedure Create_Session (Session_Leader : out Process_Group_ID) is function setsid return pid_t; pragma Import (C, setsid, setsid_LINKNAME); begin Session_Leader := Process_Group_ID (setsid); if Session_Leader = -1 then Raise_POSIX_Error; end if; end Create_Session; ----------- -- Image -- ----------- function Image (ID : Process_Group_ID) return Standard.String renames Process_Group_ID'Image; ----------- -- Value -- ----------- function Value (Str : Standard.String) return Process_Group_ID is begin return Process_Group_ID'Value (Str); end Value; ---------------------- -- Get_Real_User_ID -- ---------------------- function Get_Real_User_ID return User_ID is function getuid return uid_t; pragma Import (C, getuid, getuid_LINKNAME); begin return User_ID (getuid); end Get_Real_User_ID; --------------------------- -- Get_Effective_user_ID -- --------------------------- function Get_Effective_User_ID return User_ID is function geteuid return uid_t; pragma Import (C, geteuid, geteuid_LINKNAME); begin return User_ID (geteuid); end Get_Effective_User_ID; ----------------- -- Set_User_ID -- ----------------- procedure Set_User_ID (ID : User_ID) is function setuid (uid : uid_t) return int; pragma Import (C, setuid, setuid_LINKNAME); begin Check (setuid (uid => uid_t (ID))); end Set_User_ID; -------------------- -- Get_Login_Name -- -------------------- -- .... Consider using getlogin_r if that is supported. -- Use conditional code, based on configurable constant -- HAVE_getlogin_r. function Get_Login_Name return POSIX.POSIX_String is function getlogin return char_ptr; pragma Import (C, getlogin, getlogin_LINKNAME); Name_Ptr : char_ptr; begin Name_Ptr := getlogin; if Name_Ptr = null then Raise_POSIX_Error; end if; return Form_POSIX_String (Name_Ptr); end Get_Login_Name; ----------- -- image -- ----------- function Image (ID : User_ID) return Standard.String is begin return User_ID'Image (ID); end Image; ----------- -- Value -- ----------- function Value (Str : Standard.String) return User_ID is begin return User_ID'Value (Str); end Value; -- User Group Identification -- type Group_ID is private; ----------------------- -- Get_Real_Group_ID -- ----------------------- function Get_Real_Group_ID return Group_ID is function getgid return gid_t; pragma Import (C, getgid, getgid_LINKNAME); begin return Group_ID (getgid); end Get_Real_Group_ID; ---------------------------- -- Get_Effective_Group_ID -- ---------------------------- function Get_Effective_Group_ID return Group_ID is function getegid return gid_t; pragma Import (C, getegid, getegid_LINKNAME); begin return Group_ID (getegid); end Get_Effective_Group_ID; ------------------ -- Set_Group_ID -- ------------------ procedure Set_Group_ID (ID : Group_ID) is function setgid (gid : gid_t) return int; pragma Import (C, setgid, setgid_LINKNAME); begin Check (setgid (gid_t (ID))); end Set_Group_ID; ---------------- -- Get_Groups -- ---------------- type Access_Group_ID is access all Group_ID; function Get_Groups return Group_List is function getgroups (gidsetsize : int; grouplist : Access_Group_ID) return C.int; pragma Import (C, getgroups, getgroups_LINKNAME); begin loop declare NGroups_1 : constant int := getgroups (0, null); Groups : aliased Group_List (1 .. Integer (NGroups_1)); NGroups_2 : int; begin NGroups_2 := getgroups (Groups'Length, Groups (1)'Unchecked_Access); Check (NGroups_2); if NGroups_1 = NGroups_2 then return Groups; end if; end; end loop; -- the loop is in case some other process changes the number of -- items in the group list, -- before the first and second call to getgroups end Get_Groups; ----------- -- Image -- ----------- function Image (ID : Group_ID) return Standard.String is begin return Trim_Leading_Blank (Group_ID'Image (ID)); end Image; ----------- -- Value -- ----------- function Value (Str : Standard.String) return Group_ID is begin return Group_ID (Group_ID'Value (Str)); end Value; end POSIX.Process_Identification; florist-gpl-2017-src/libsrc/posix-io.adb0000644000076700001450000006363413106553472017526 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . I O -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2010, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- ????? -- Perhaps we should put exception handlers around the critical -- sections in this code, in case Storage_Error is raised by one -- of the system calls within them? This would be a lot more overhead. with Ada.IO_Exceptions, System.Storage_Elements, POSIX.Implementation, POSIX.Permissions.Implementation, Unchecked_Conversion; package body POSIX.IO is use POSIX.C, POSIX.Implementation, POSIX.Permissions.Implementation; function To_int is new Unchecked_Conversion (Bits, int); function To_Bits is new Unchecked_Conversion (int, Bits); C_File_Mode : constant array (File_Mode) of Bits := (Read_Only => O_RDONLY, Write_Only => O_WRONLY, Read_Write => O_RDWR); C_Whence : constant array (Position) of int := (From_Beginning => SEEK_SET, From_End_Of_File => SEEK_END, From_Current_Position => SEEK_CUR); procedure Check_NNeg_And_Restore_Signals (Result : int; Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access); procedure Check_NNeg_And_Restore_Signals (Result : ssize_t; Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access); pragma Inline (Check_NNeg_And_Restore_Signals); procedure Check_NNeg_And_Restore_Signals (Result : int; Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access) is begin if Result < 0 then Restore_Signals_And_Raise_POSIX_Error (Masked_Signals, Old_Mask); else Restore_Signals (Masked_Signals, Old_Mask); end if; end Check_NNeg_And_Restore_Signals; procedure Check_NNeg_And_Restore_Signals (Result : ssize_t; Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access) is begin if Result < 0 then Restore_Signals_And_Raise_POSIX_Error (Masked_Signals, Old_Mask); else Restore_Signals (Masked_Signals, Old_Mask); end if; end Check_NNeg_And_Restore_Signals; ------------ -- Open -- ------------ function open (path : char_ptr; oflag : int) return int; function open (path : char_ptr; oflag : int; mode : mode_t) return int; pragma Import (C, open, open_LINKNAME); function Open (Name : Pathname; Mode : File_Mode; Options : Open_Option_Set := Empty_Set; Masked_Signals : Signal_Masking := RTS_Signals) return File_Descriptor is Result : int; Name_With_NUL : POSIX_String := Name & NUL; Old_Mask : aliased Signal_Mask; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := open (path => Name_With_NUL (Name_With_NUL'First)'Unchecked_Access, oflag => To_int (Option_Set (Options).Option or C_File_Mode (Mode))); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); return File_Descriptor (Result); end Open; ---------------------- -- Open_Or_Create -- ---------------------- function Open_Or_Create (Name : Pathname; Mode : File_Mode; Permissions : POSIX.Permissions.Permission_Set; Options : Open_Option_Set := Empty_Set; Masked_Signals : POSIX.Signal_Masking := RTS_Signals) return File_Descriptor is Result : int; Name_With_NUL : POSIX_String := Name & NUL; Old_Mask : aliased Signal_Mask; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := open (path => Name_With_NUL (Name_With_NUL'First)'Unchecked_Access, oflag => To_int (Option_Set (Options).Option or C_File_Mode (Mode) or O_CREAT), mode => Form_C_Permission (Permissions)); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); return File_Descriptor (Result); end Open_Or_Create; --------------- -- Is_Open -- --------------- function fcntl (fildes : int; cmd : int) return int; function fcntl (fildes : int; cmd : int; arg : int) return int; pragma Import (C, fcntl, fcntl_LINKNAME); function Is_Open (File : File_Descriptor) return Boolean is begin return fcntl (int (File), F_GETFL) /= -1; end Is_Open; ------------- -- Close -- ------------- function close (fildes : int) return int; pragma Import (C, close, close_LINKNAME); procedure Close (File : File_Descriptor; Masked_Signals : Signal_Masking := RTS_Signals) is Old_Mask : aliased Signal_Mask; Result : int; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := close (int (File)); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Close; ----------------- -- Duplicate -- ----------------- function dup (fildes : int) return int; pragma Import (C, dup, dup_LINKNAME); function Duplicate (File : File_Descriptor; Target : File_Descriptor := 0) return File_Descriptor is pragma Warnings (Off, Target); begin return File_Descriptor (Check (dup (int (File)))); end Duplicate; --------------------------- -- Duplicate_and_Close -- --------------------------- function dup2 (fildes, fildes2 : int) return int; -- fildes = old fd, fildes2 = new fd pragma Import (C, dup2, dup2_LINKNAME); function Duplicate_and_Close (File : File_Descriptor; Target : File_Descriptor := 0; Masked_Signals : Signal_Masking := RTS_Signals) return File_Descriptor is Old_Mask : aliased Signal_Mask; Result : int; begin if File = Target then return Target; end if; Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := dup2 (int (File), int (Target)); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); return File_Descriptor (Result); end Duplicate_and_Close; ------------------- -- Create_Pipe -- ------------------- type fildes_pair is array (1 .. 2) of File_Descriptor; function pipe (fildes : access fildes_pair) return int; pragma Import (C, pipe, pipe_LINKNAME); procedure Create_Pipe (Read_End : out File_Descriptor; Write_End : out File_Descriptor) is Fildes : aliased fildes_pair; begin Check_NZ (pipe (Fildes'Unchecked_Access)); Read_End := Fildes (1); Write_End := Fildes (2); end Create_Pipe; ------------ -- Read -- ------------ -- .... Change P1003.5? -- We have trouble getting a pointer to the Buffer argument, -- which we need in order to pass it through to the OS. -- 1) The type Ada.Streams.Stream_Element_Array -- is not declared with aliased components. This prevents us -- from using Buffer (Buffer'First)'Unchecked_Access. -- 2) The parameter Buffer is not aliased, so we can't use -- Buffer'Unchecked_Access. -- 3) The parameter Buffer is not itself an access parameter. -- Therefore, we use Buffer (Buffer'First)'Address. -- The compiler should always -- accept this, but some day it may quietly stop working, as it relies -- on assumptions about the meaning of 'Address and how the compiler -- chooses to pass the parameter Buffer. -- If this breaks here, then it will also break in several other -- places, where we use the same technique. function read (fildes : int; buf : System.Address; nbyte : size_t) return ssize_t; pragma Import (C, read, read_LINKNAME); procedure Read (File : File_Descriptor; Buffer : out IO_Buffer; Last : out IO_Count; Masked_Signals : Signal_Masking := RTS_Signals) is Result : ssize_t; Old_Mask : aliased Signal_Mask; begin if Buffer'Length = 0 then Last := IO_Count (Buffer'First) - 1; return; end if; Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := read (int (File), Buffer (Buffer'First)'Address, size_t (Buffer'Last - Buffer'First + 1)); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); Last := IO_Count (Buffer'First) + IO_Count (Result) - 1; if Result = 0 then raise Ada.IO_Exceptions.End_Error; end if; end Read; procedure NONSTANDARD_Read (File : File_Descriptor; Buffer : out IO_Buffer; Last : out Natural; Masked_Signals : Signal_Masking := RTS_Signals) is Result : ssize_t; Old_Mask : aliased Signal_Mask; begin if Buffer'Length = 0 then Last := Buffer'First - 1; return; end if; Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := read (int (File), Buffer (Buffer'First)'Address, size_t (Buffer'Last - Buffer'First + 1)); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); Last := Buffer'First + Integer (Result) - 1; if Result = 0 then raise Ada.IO_Exceptions.End_Error; end if; end NONSTANDARD_Read; procedure Read (File : File_Descriptor; Buffer : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Masked_Signals : Signal_Masking := RTS_Signals) is Result : ssize_t; Old_Mask : aliased Signal_Mask; use Ada.Streams; begin if Buffer'Length = 0 then Last := Buffer'First - 1; return; end if; Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := read (int (File), Buffer (Buffer'First)'Address, size_t (Buffer'Last - Buffer'First + 1)); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); Last := Buffer'First + Ada.Streams.Stream_Element_Offset (Result) - 1; if Result = 0 then raise Ada.IO_Exceptions.End_Error; end if; end Read; -- .... Consider writing one lower-level subprogram for Read and -- having both versions call it. Similarly for Write. ------------- -- Write -- ------------- function write (fildes : int; buf : System.Address; nbyte : size_t) return ssize_t; pragma Import (C, write, write_LINKNAME); -- ....Change POSIX.5???? -- Something is inconsistent here. -- If Last is the last position, then for a null array -- we don't want to set it to zero! procedure Write (File : File_Descriptor; Buffer : IO_Buffer; Last : out IO_Count; Masked_Signals : Signal_Masking := RTS_Signals) is Result : ssize_t; Old_Mask : aliased Signal_Mask; begin if Buffer'Length = 0 then Last := IO_Count (Buffer'First - 1); return; end if; Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := write (int (File), Buffer (Buffer'First)'Address, size_t (Buffer'Last - Buffer'First + 1)); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); Last := IO_Count (Buffer'First) + IO_Count (Result) - 1; end Write; -- .... Change POSIX.5????? -- The type of Last really should be Natural, since it is -- an index in a POSIX_String array. procedure NONSTANDARD_Write (File : File_Descriptor; Buffer : IO_Buffer; Last : out Natural; Masked_Signals : Signal_Masking := RTS_Signals) is Result : ssize_t; Old_Mask : aliased Signal_Mask; begin if Buffer'Length = 0 then Last := Buffer'First - 1; return; end if; Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := write (int (File), Buffer (Buffer'First)'Address, size_t (Buffer'Last - Buffer'First + 1)); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); Last := Buffer'First + Integer (Result) - 1; end NONSTANDARD_Write; procedure Write (File : File_Descriptor; Buffer : Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Masked_Signals : Signal_Masking := RTS_Signals) is Result : ssize_t; Old_Mask : aliased Signal_Mask; use Ada.Streams; begin if Buffer'Length = 0 then Last := Buffer'First - 1; return; end if; Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := write (int (File), Buffer (Buffer'First)'Address, size_t (Buffer'Last - Buffer'First + 1)); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); Last := Buffer'First + Ada.Streams.Stream_Element_Offset (Result) - 1; end Write; -------------------- -- Generic_Read -- -------------------- procedure Generic_Read (File : File_Descriptor; Item : out T; Masked_Signals : Signal_Masking := RTS_Signals) is Result : ssize_t; Old_Mask : aliased Signal_Mask; begin if Item'Size rem char'Size /= 0 then Raise_POSIX_Error (Operation_Not_Implemented); end if; Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := read (int (File), Item'Address, size_t (Item'Size / char'Size)); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); if Result < Item'Size / char'Size then raise Ada.IO_Exceptions.End_Error; end if; end Generic_Read; --------------------- -- Generic_Write -- --------------------- procedure Generic_Write (File : File_Descriptor; Item : T; Masked_Signals : Signal_Masking := RTS_Signals) is Result : ssize_t; Written : System.Storage_Elements.Storage_Offset := 0; To_Write : System.Storage_Elements.Storage_Offset := System.Storage_Elements.Storage_Offset (Item'Size / char'Size); Old_Mask : aliased Signal_Mask; use System.Storage_Elements; begin if Item'Size rem char'Size /= 0 then Raise_POSIX_Error (Operation_Not_Implemented); end if; Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); -- Write is called iteratively because it may only perform a -- partial write, for example in the case the filesystem is -- full. If fewer bytes are written than expected then try -- again to write the remaining portion of the object. loop Result := write (int (File), Item'Address + Written, size_t (To_Write - Written)); -- Exit if write fails or zero-length write succeeds. exit when Result <= 0; Written := Written + Storage_Offset (Result); To_Write := To_Write - Storage_Offset (Result); -- Exit if done writing. exit when To_Write = 0; end loop; Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Generic_Write; ------------ -- Seek -- ------------ function lseek (fildes : int; offset : off_t; whence : int) return off_t; pragma Import (C, lseek, lseek_LINKNAME); procedure Seek (File : File_Descriptor; Offset : IO_Offset; Result : out IO_Offset; Starting_Point : Position := From_Beginning) is begin Result := IO_Offset (lseek (int (File), off_t (Offset), C_Whence (Starting_Point))); Check (int (Result)); end Seek; ----------------- -- File_Size -- ----------------- function File_Size (File : File_Descriptor) return IO_Count is Prevoff, Endoff : off_t; begin Begin_Critical_Section; Prevoff := lseek (int (File), 0, SEEK_CUR); if Prevoff < 0 then End_Critical_Section; Raise_POSIX_Error; end if; Endoff := lseek (int (File), 0, SEEK_END); if Endoff < 0 then End_Critical_Section; Raise_POSIX_Error; end if; Prevoff := lseek (int (File), Prevoff, SEEK_SET); if Prevoff < 0 then End_Critical_Section; Raise_POSIX_Error; end if; End_Critical_Section; return (IO_Count (Endoff)); end File_Size; --------------------- -- File_Position -- --------------------- function File_Position (File : File_Descriptor) return IO_Offset is begin return IO_Offset (Check (int (lseek (int (File), 0, SEEK_CUR)))); end File_Position; --------------------- -- Is_A_Terminal -- --------------------- function isatty (fildes : int) return int; pragma Import (C, isatty, isatty_LINKNAME); function Is_A_Terminal (File : File_Descriptor) return Boolean is begin return isatty (int (File)) = 1; end Is_A_Terminal; ------------------------- -- Get_Terminal_Name -- ------------------------- function ttyname (fildes : int) return char_ptr; pragma Import (C, ttyname, ttyname_LINKNAME); function Get_Terminal_Name (File : File_Descriptor) return Pathname is Result : char_ptr; begin Result := ttyname (int (File)); if Result = null then Raise_POSIX_Error; end if; return Form_POSIX_String (Result); end Get_Terminal_Name; ------------------------ -- Get_File_Control -- ------------------------ procedure Get_File_Control (File : File_Descriptor; Mode : out File_Mode; Options : out Open_Option_Set) is Result : Bits; Access_Mode : Bits; begin Defer_Abortion; Result := To_Bits (Check (fcntl (int (File), F_GETFL))); Undefer_Abortion; Access_Mode := Result and O_ACCMODE; if Access_Mode = O_RDONLY then Mode := Read_Only; elsif Access_Mode = O_WRONLY then Mode := Write_Only; elsif Access_Mode = O_RDWR then Mode := Read_Write; else Raise_POSIX_Error (ENOSYS); -- should never be reached end if; Options := Open_Option_Set (Option_Set' (Option => Result and not O_ACCMODE)); end Get_File_Control; ------------------------ -- Set_File_Control -- ------------------------ C_Other_Open_Options : constant Bits := O_TRUNC or O_EXCL or O_NOCTTY or O_SYNC or O_DSYNC or O_RSYNC or O_RDONLY or O_RDWR or O_WRONLY; procedure Set_File_Control (File : File_Descriptor; Options : Open_Option_Set) is Old_Values : int; New_Values : Bits; begin Begin_Critical_Section; Old_Values := fcntl (int (File), F_GETFL); if Old_Values = -1 then End_Critical_Section; Raise_POSIX_Error; end if; New_Values := (Option_Set (Options).Option and not C_Other_Open_Options) or (To_Bits (Old_Values) and C_Other_Open_Options); if fcntl (int (File), F_SETFL, To_int (New_Values)) = -1 then End_Critical_Section; Raise_POSIX_Error; end if; End_Critical_Section; end Set_File_Control; ------------------------- -- Get_Close_On_Exec -- ------------------------- function Get_Close_On_Exec (File : File_Descriptor) return Boolean is Result : int; begin Result := fcntl (int (File), F_GETFD); if Result = -1 then Raise_POSIX_Error; end if; return (To_Bits (Result) and FD_CLOEXEC) /= 0; end Get_Close_On_Exec; ------------------------- -- Set_Close_On_Exec -- ------------------------- procedure Set_Close_On_Exec (File : File_Descriptor; To : Boolean := True) is Flags : Bits; pragma Warnings (Off); Result : int; begin Begin_Critical_Section; Flags := To_Bits (fcntl (int (File), F_GETFD)); if Flags = -1 then End_Critical_Section; Raise_POSIX_Error; end if; if To then Flags := Flags or FD_CLOEXEC; else Flags := Flags and not FD_CLOEXEC; end if; if fcntl (int (File), F_SETFD, To_int (Flags)) = -1 then End_Critical_Section; Raise_POSIX_Error; end if; Result := fcntl (int (File), F_GETFD); -- should not fail since previous call did not fail -- ??? Is it the case that the value of Result should not be checked pragma Warnings (Off); End_Critical_Section; end Set_Close_On_Exec; ------------------------- -- Change_Permission -- ------------------------- function fchmod (fildes : int; mode : mode_t) return int; pragma Import (C, fchmod, fchmod_LINKNAME); procedure Change_Permissions (File : File_Descriptor; Permission : POSIX.Permissions.Permission_Set) is begin Check (fchmod (int (File), Form_C_Permission (Permission))); end Change_Permissions; --------------------- -- Truncate_File -- --------------------- function ftruncate (fildes : int; length : off_t) return int; pragma Import (C, ftruncate, ftruncate_LINKNAME); procedure Truncate_File (File : File_Descriptor; Length : IO_Count) is begin Check (ftruncate (int (File), off_t (Length))); end Truncate_File; ------------------------ -- Synchronize_File -- ------------------------ function fsync (fildes : int) return int; pragma Import (C, fsync, fsync_LINKNAME); procedure Synchronize_File (File : File_Descriptor) is begin Check (fsync (int (File))); end Synchronize_File; ------------------------ -- Synchronize_Data -- ------------------------ function fdatasync (fildes : int) return int; pragma Import (C, fdatasync, fdatasync_LINKNAME); procedure Synchronize_Data (File : File_Descriptor) is begin Check (fdatasync (int (File))); end Synchronize_Data; -- 6.1.12 Sockets File Ownership procedures from P1003.5c pragma Warnings (Off); procedure Get_Owner (File : File_Descriptor; Process : out POSIX.Process_Identification.Process_ID; Group : out POSIX.Process_Identification.Process_Group_ID) is begin Raise_POSIX_Error (Operation_Not_Implemented); end Get_Owner; pragma Warnings (On); procedure Set_Socket_Process_Owner (File : File_Descriptor; Process : POSIX.Process_Identification.Process_ID) is pragma Unreferenced (File); pragma Unreferenced (Process); begin Raise_POSIX_Error (Operation_Not_Implemented); end Set_Socket_Process_Owner; procedure Set_Socket_Group_Owner (File : File_Descriptor; Group : POSIX.Process_Identification.Process_Group_ID) is pragma Unreferenced (File); pragma Unreferenced (Group); begin Raise_POSIX_Error (Operation_Not_Implemented); end Set_Socket_Group_Owner; procedure Set_Buffer (Vector : in out IO_Vector; Buffer : System.Address; Length : Positive) is begin Vector.C.iov_base := To_char_ptr (Buffer); Vector.C.iov_len := size_t (Length); end Set_Buffer; procedure Get_Buffer (Vector : IO_Vector; Buffer : out System.Address; Length : out POSIX.IO_Count) is begin Buffer := To_Address (Vector.C.iov_base); Length := POSIX.IO_Count (Vector.C.iov_len); end Get_Buffer; end POSIX.IO; florist-gpl-2017-src/libsrc/posix-error_codes.ads0000644000076700001450000000702013106553472021431 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . E R R O R _ C O D E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996-1999 Florida State University (FSU), All Rights -- -- Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- It may seem that this mechanism should not be necessary, since the -- errno value supported by the C-language interface is per-thread. -- Unfortunately, that per-thread value may be overwritten by -- implicit OS service calls that take place between the point an -- exception is raised and the point that it is handled. For -- example, if raising an exception involves calling longjmp(), the -- longjmp() call may overwrite the previous errno value. Since this -- mechanism does add overhead, we are making its use selectable, via -- gnatprep. with Ada.Task_Attributes; package POSIX.Error_Codes is new Ada.Task_Attributes (POSIX.Error_Code, POSIX.No_Error); florist-gpl-2017-src/libsrc/posix_supplement_to_ada_io.ads0000644000076700001450000000601213106553472023377 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ S U P P L E M E N T _ T O _ A D A _ I O -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 1991-1994 Florida State University -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Supplement_to_Ada_IO; pragma Elaborate_All (POSIX.Supplement_to_Ada_IO); package POSIX_Supplement_to_Ada_IO renames POSIX.Supplement_to_Ada_IO; florist-gpl-2017-src/libsrc/posix_options.ads0000644000076700001450000000560413106553472020706 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ O P T I O N S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Options; pragma Elaborate_All (POSIX.Options); package POSIX_Options renames POSIX.Options; florist-gpl-2017-src/libsrc/posix.adb0000644000076700001450000005464713106553472017125 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X -- -- -- -- B o d y -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.Implementation, System, Unchecked_Conversion, Unchecked_Deallocation; pragma Elaborate (POSIX.C); pragma Elaborate (POSIX.Implementation); package body POSIX is use Ada.Streams; use POSIX.C; use POSIX.Implementation; type String_List is new POSIX.Implementation.String_List; ----------------------------- -- Unchecked Conversions -- ----------------------------- type Big_POSIX_String_Ptr is access all POSIX_String (Positive'Range); type Big_String_Ptr is access all String (Positive'Range); type Big_Stream_Element_Array_Ptr is access all Ada.Streams.Stream_Element_Array (Ada.Streams.Stream_Element_Offset'Range); function From_Address is new Unchecked_Conversion (System.Address, Big_String_Ptr); function From_Address is new Unchecked_Conversion (System.Address, Big_POSIX_String_Ptr); function From_Address is new Unchecked_Conversion (System.Address, Big_Stream_Element_Array_Ptr); ----------------------- -- To_POSIX_String -- ----------------------- function To_POSIX_String (Str : String) return POSIX_String is begin return From_Address (Str'Address) (1 .. Str'Length); end To_POSIX_String; ----------------- -- To_String -- ----------------- function To_String (Str : POSIX_String) return String is begin return From_Address (Str'Address) (1 .. Str'Length); end To_String; ---------------------- -- To_Wide_String -- ---------------------- function To_Wide_String (Str : POSIX_String) return Wide_String is Result : Wide_String (Str'Range); begin for I in Str'Range loop Result (I) := Wide_Character'Val (POSIX_Character'Pos (Str (I))); end loop; return Result; end To_Wide_String; -- We cannot use direct unchecked conversion here, -- since the sizes of the characters are different. -- However, we rely that the integer codes for the -- first 256 wide characters are the same as those -- of the ordinary characters. [See ARM A.1 (36)] ----------------------- -- To_POSIX_String -- ----------------------- function To_POSIX_String (Str : Wide_String) return POSIX_String is Result : POSIX_String (Str'Range); begin for I in Str'Range loop Result (I) := POSIX_Character'Val (Wide_Character'Pos (Str (I)) rem 256); end loop; return Result; end To_POSIX_String; ------------------------------- -- To_Stream_Element_Array -- ------------------------------- function To_Stream_Element_Array (Buffer : POSIX_String) return Ada.Streams.Stream_Element_Array is subtype Offset is Stream_Element_Offset; begin return From_Address (Buffer'Address) ((Offset (Buffer'First) + Offset'First - 1) .. (Offset (Buffer'Last) + Offset'First - 1)); end To_Stream_Element_Array; ----------------------- -- To_POSIX_String -- ----------------------- function To_POSIX_String (Buffer : Ada.Streams.Stream_Element_Array) return POSIX_String is subtype Offset is Stream_Element_Offset; begin return From_Address (Buffer'Address) (Positive (Buffer'First - Offset'First + 1) .. Positive (Buffer'Last - Offset'First + 1)); end To_POSIX_String; ------------------- -- Is_Filename -- ------------------- function Is_Filename (Str : POSIX_String) return Boolean is begin if To_String (Str)'Length = 0 then return False; end if; for I in Str'Range loop if Str (I) = '/' or Str (I) = NUL or Str (I) = ' ' then return False; end if; end loop; return True; end Is_Filename; -- These two functions (Is_Pathname and Is_Filename) seem -- not to be unimplementable in a portable way, since they are -- supposed to "check all constraints set on filename and -- pathname by the implementation that can be checked without -- accessing the file system directly. ------------------- -- Is_Pathname -- ------------------- function Is_Pathname (Str : POSIX_String) return Boolean is begin if To_String (Str)'Length = 0 then return False; end if; for I in Str'Range loop if Str (I) = NUL or Str (I) = ' ' then return False; end if; end loop; return True; end Is_Pathname; ---------------------------- -- Is_Portable_filename -- ---------------------------- function Is_Portable_Filename (Str : POSIX_String) return Boolean is begin if To_String (Str)'Length = 0 then return False; end if; for I in Str'Range loop case Str (I) is when 'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '.' | '_' => null; when '-' => if I = Str'First then return False; end if; when others => return False; end case; end loop; return True; end Is_Portable_Filename; ---------------------------- -- Is_Portable_Pathname -- ---------------------------- function Is_Portable_Pathname (Str : POSIX_String) return Boolean is Start : Positive; P : Positive; begin if To_String (Str)'Length = 0 then return False; end if; Start := Str'First; P := Str'First; loop if P > Str'Last or else Str (P) = '/' then if Start < P and then not Is_Portable_Filename (Str (Start .. P - 1)) then return False; end if; if P > Str'Last then return True; end if; Start := P + 1; end if; P := P + 1; end loop; end Is_Portable_Pathname; ------------------ -- Make_Empty -- ------------------ procedure Free is new Unchecked_Deallocation (POSIX_String, POSIX_String_Ptr); procedure Free is new Unchecked_Deallocation (String_List, POSIX_String_List); procedure Make_Empty (List : in out POSIX_String_List) is begin if List = null then return; end if; for I in 1 .. List.Length loop if List.List (I) = null then exit; end if; Free (List.List (I)); end loop; Free (List); end Make_Empty; -------------- -- Append -- -------------- procedure Append (List : in out POSIX_String_List; Str : POSIX_String) is Tmp : POSIX_String_List; Len : constant Integer := Str'Length; begin if List = null then List := new String_List (Min_String_List_Length); -- rely that pointers all initialized to null end if; for I in 1 .. List.Length loop if List.List (I) = null then if I = List.Length then Tmp := new String_List (2 * List.Length); Tmp.List (List.List'Range) := List.List; Tmp.Char (List.List'Range) := List.Char; Free (List); List := Tmp; end if; List.List (I) := new POSIX_String (1 .. Len + 1); List.List (I)(1 .. Len) := Str; List.List (I)(Len + 1) := NUL; List.Char (I) := List.List (I)(1)'Unchecked_Access; return; end if; end loop; end Append; ---------------------- -- For_Every_Item -- ---------------------- -- generic -- with procedure Action -- (Item: POSIX_String; Quit: in out Boolean); procedure For_Every_Item (List : POSIX_String_List) is Quit : Boolean := False; begin if List = null then return; end if; for I in 1 .. List.Length loop exit when List.List (I) = null; declare L : constant Integer := List.List (I)'Length; begin Action (List.List (I)(1 .. L - 1), Quit); end; exit when Quit; end loop; end For_Every_Item; -------------- -- Length -- -------------- function Length (List : POSIX_String_List) return Natural is begin if List = null then return 0; end if; for I in 1 .. List.Length loop if List.List (I) = null then return Natural (I - 1); end if; end loop; raise Program_Error; return 0; end Length; ------------- -- Value -- ------------- function Value (List : POSIX_String_List; Index : Positive) return POSIX_String is I : constant Positive := Index; begin if List = null or else not (I <= List.Length) or else List.List (I) = null then raise Constraint_Error; end if; declare L : constant Integer := List.List (I).all'Length; begin return List.List (I)(1 .. L - 1); end; end Value; ----------------- -- Empty_set -- ----------------- function Empty_Set return Option_Set is begin return (Option => 0); end Empty_Set; ----------- -- "+" -- ----------- function "+" (L, R : Option_Set) return Option_Set is begin return (Option => Bits (unsigned (L.Option) or unsigned (R.Option))); end "+"; ----------- -- "-" -- ----------- function "-" (L, R : Option_Set) return Option_Set is begin return (Option => Bits (unsigned (L.Option) and not (unsigned (R.Option)))); end "-"; --------- -- < -- --------- function "<" (Left, Right : Option_Set) return Boolean is begin return (Left <= Right) and (Left /= Right); end "<"; --------- -- <= -- --------- function "<=" (Left, Right : Option_Set) return Boolean is begin return (((not Bits (unsigned (Right.Option)))) and Bits (unsigned (Left.Option))) = 0; end "<="; --------- -- > -- --------- function ">" (Left, Right : Option_Set) return Boolean is begin return Right < Left; end ">"; ---------- -- >= -- ---------- function ">=" (Left, Right : Option_Set) return Boolean is begin return Right <= Left; end ">="; ---------------------- -- Get_Error_Code -- ---------------------- function Get_Error_Code return Error_Code is begin return POSIX.Implementation.Get_Ada_Error_Code; end Get_Error_Code; ---------------------- -- Set_Error_Code -- ---------------------- procedure Set_Error_Code (Error : Error_Code) is begin POSIX.Implementation.Set_Ada_Error_Code (Error); end Set_Error_Code; ---------------------- -- Is_POSIX_Error -- ---------------------- function Is_POSIX_Error (Error : Error_Code) return Boolean is use Bogus_Error_Codes; begin for I in Error_Array'Range loop if Error = Error_Array (I) then return True; end if; end loop; return False; end Is_POSIX_Error; ------------- -- Image -- ------------- function Image (Error : Error_Code) return String is use Bogus_Error_Codes; begin for I in Error_Array'Range loop if Error = Error_Array (I) then return Error_Name_Enum'Image (I); end if; end loop; declare Tmp : constant String := Error_Code'Image (Error); begin if Tmp (Tmp'First) /= ' ' then return Tmp; end if; return Tmp (Tmp'First + 1 .. Tmp'Last); end; end Image; function uname (name : access struct_utsname) return int; pragma Import (C, uname, uname_LINKNAME); ------------------- -- System_Name -- ------------------- function System_Name return POSIX_String is Name : aliased struct_utsname; begin Check (uname (Name'Unchecked_Access)); return Form_POSIX_String (Name.sysname (1)'Unchecked_Access); end System_Name; ----------------- -- Node_Name -- ----------------- function Node_Name return POSIX_String is Name : aliased struct_utsname; begin Check (uname (Name'Unchecked_Access)); return Form_POSIX_String (Name.nodename (1)'Unchecked_Access); end Node_Name; --------------- -- Release -- --------------- function Release return POSIX_String is Name : aliased struct_utsname; begin Check (uname (Name'Unchecked_Access)); return Form_POSIX_String (Name.release (1)'Unchecked_Access); end Release; --------------- -- Version -- --------------- function Version return POSIX_String is Name : aliased struct_utsname; begin Check (uname (Name'Unchecked_Access)); return Form_POSIX_String (Name.version (1)'Unchecked_Access); end Version; --------------- -- Machine -- --------------- function Machine return POSIX_String is Name : aliased struct_utsname; begin Check (uname (Name'Unchecked_Access)); return Form_POSIX_String (Name.machine (1)'Unchecked_Access); end Machine; ----------------------------------------- -- Timespec Composition/Decomposition -- ----------------------------------------- procedure Split (D : Duration; S : out Duration; NS : out Duration); pragma Inline (Split); -- Decompose D into seconds (S) and nanoseconds (NS) parts, -- with the nanosecond part in the range 0.0 .. 0.999999999. procedure Split (D : Duration; S : out Duration; NS : out Duration) is begin S := POSIX.Implementation.To_Duration (To_D_Int (D / NS_per_S) * NS_per_S); NS := D - S; if NS < 0.0 then S := S - 1.0; NS := NS + 1.0; end if; end Split; ------------- -- Split -- ------------- procedure Split (Time : Timespec; S : out Seconds; NS : out Nanoseconds) is SD, NSD : Duration; begin Split (Time.Val, S => SD, NS => NSD); S := Seconds (SD); NS := Nanoseconds (NSD * NS_per_S); end Split; ------------------- -- To_Timespec -- ------------------- function To_Timespec (S : Seconds; NS : Nanoseconds) return Timespec is begin return Timespec' (Val => Duration (S) + Duration (NS) / NS_per_S); end To_Timespec; ------------------- -- Get_Seconds -- ------------------- function Get_Seconds (Time : Timespec) return Seconds is SD, NSD : Duration; begin Split (Time.Val, S => SD, NS => NSD); return Seconds (SD); end Get_Seconds; ----------------------- -- Get_Nanoseconds -- ----------------------- function Get_Nanoseconds (Time : Timespec) return Nanoseconds is SD, NSD : Duration; begin Split (Time.Val, S => SD, NS => NSD); return Nanoseconds (NSD * NS_per_S); end Get_Nanoseconds; ----------------------- -- Set_Nanoseconds -- ----------------------- procedure Set_Nanoseconds (Time : in out Timespec; NS : Nanoseconds) is SD, NSD : Duration; begin Split (Time.Val, S => SD, NS => NSD); Time.Val := SD + Duration (NS) / NS_per_S; end Set_Nanoseconds; ------------------- -- Set_Seconds -- ------------------- procedure Set_Seconds (Time : in out Timespec; S : Seconds) is SD, NSD : Duration; begin Split (Time.Val, S => SD, NS => NSD); Time.Val := Duration (S) + NSD; end Set_Seconds; ----------- -- "+" -- ----------- function "+" (Left, Right : Timespec) return Timespec is begin return Timespec'(Val => Left.Val + Right.Val); end "+"; ----------- -- "+" -- ----------- function "+" (Left : Timespec; Right : Nanoseconds) return Timespec is begin return Timespec' (Val => Left.Val + Duration (Right) / NS_per_S); end "+"; ----------- -- "-" -- ----------- function "-" (Right : Timespec) return Timespec is begin return Timespec'(Val => -Right.Val); end "-"; ----------- -- "-" -- ----------- function "-" (Left, Right : Timespec) return Timespec is begin return Timespec'(Val => Left.Val - Right.Val); end "-"; ----------- -- "-" -- ----------- function "-" (Left : Timespec; Right : Nanoseconds) return Timespec is begin return Timespec'(Val => Left.Val - Duration (Right) / NS_per_S); end "-"; ----------- -- "*" -- ----------- function "*" (Left : Timespec; Right : Integer) return Timespec is begin return Timespec'(Val => Left.Val * Duration (Right)); end "*"; ----------- -- "*" -- ----------- function "*" (Left : Integer; Right : Timespec) return Timespec is begin return Timespec'(Val => Left * Right.Val); end "*"; ----------- -- "/" -- ----------- function "/" (Left : Timespec; Right : Integer) return Timespec is begin return Timespec'(Val => Left.Val / Right); end "/"; ----------- -- "/" -- ----------- function "/" (Left, Right : Timespec) return Integer is begin return Integer (Left.Val / Right.Val); end "/"; ----------- -- "<" -- ----------- function "<" (Left, Right : Timespec) return Boolean is begin return Left.Val < Right.Val; end "<"; ----------- -- "<=" -- ----------- function "<=" (Left, Right : Timespec) return Boolean is begin return Left.Val <= Right.Val; end "<="; ----------- -- ">" -- ----------- function ">" (Left, Right : Timespec) return Boolean is begin return Right <= Left; end ">"; ------------ -- ">=" -- ------------ function ">=" (Left, Right : Timespec) return Boolean is begin return Right < Left; end ">="; ------------------- -- To_Timespec -- ------------------- function To_Timespec (D : Duration) return Timespec is begin return Timespec'(Val => D); end To_Timespec; ------------------- -- To_Duration -- ------------------- function To_Duration (Time : Timespec) return Duration is begin return Time.Val; end To_Duration; -------------------------------- -- Host_To_Network_Byte_Order -- -------------------------------- function Host_To_Network_Byte_Order (Host_32 : Interfaces.Unsigned_32) return Interfaces.Unsigned_32 is function c_htonl (host_32 : Interfaces.Unsigned_32) return Interfaces.Unsigned_32; pragma Import (C, c_htonl, "c_htonl"); begin return c_htonl (Host_32); end Host_To_Network_Byte_Order; function Host_To_Network_Byte_Order (Host_16 : Interfaces.Unsigned_16) return Interfaces.Unsigned_16 is function c_htons (host_16 : Interfaces.Unsigned_16) return Interfaces.Unsigned_16; pragma Import (C, c_htons, "c_htons"); begin return c_htons (Host_16); end Host_To_Network_Byte_Order; -------------------------------- -- Host_To_Network_Byte_Order -- -------------------------------- function Network_To_Host_Byte_Order (Host_32 : Interfaces.Unsigned_32) return Interfaces.Unsigned_32 is function c_ntohl (host_32 : Interfaces.Unsigned_32) return Interfaces.Unsigned_32; pragma Import (C, c_ntohl, "c_ntohl"); begin return c_ntohl (Host_32); end Network_To_Host_Byte_Order; function Network_To_Host_Byte_Order (Host_16 : Interfaces.Unsigned_16) return Interfaces.Unsigned_16 is function c_ntohs (host_16 : Interfaces.Unsigned_16) return Interfaces.Unsigned_16; pragma Import (C, c_ntohs, "c_ntohs"); begin return c_ntohs (Host_16); end Network_To_Host_Byte_Order; begin -- We rely on Duration being an exact count of nanoseconds pragma Assert (Duration'Small = 1.0 / NS_per_S); null; end POSIX; florist-gpl-2017-src/libsrc/posix-semaphores.ads0000644000076700001450000001262313106553472021276 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . S E M A P H O R E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2010, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.IO, POSIX.Permissions; package POSIX.Semaphores is type Semaphore is limited private; type Semaphore_Descriptor is private; procedure Initialize (Sem : in out Semaphore; Value : Natural; Is_Shared : Boolean := False); function Descriptor_Of (Sem : Semaphore) return Semaphore_Descriptor; procedure Finalize (Sem : in out Semaphore); function Open (Name : POSIX.POSIX_String; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return Semaphore_Descriptor; function Open_Or_Create (Name : POSIX.POSIX_String; Permissions : POSIX.Permissions.Permission_Set; Value : Natural; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return Semaphore_Descriptor; procedure Close (Sem : in out Semaphore_Descriptor); procedure Unlink_Semaphore (Name : POSIX.POSIX_String); procedure Wait (Sem : Semaphore_Descriptor; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); function Try_Wait (Sem : Semaphore_Descriptor) return Boolean; procedure Post (Sem : Semaphore_Descriptor); function Get_Value (Sem : Semaphore_Descriptor) return Integer; -- .... Change POSIX.5b? -- The Wait and Try_Wait operations are allowed to be interruptible -- by a signal, according to the C binding. Here, we have no -- Masked_Signals parameter. If the system support POSIX threads, -- we are probably OK, since we will want to keep most signals masked, -- in all threads but the corresponding handler (if any). private -- We rely that type Semaphore will be passed by reference, -- so that we can use 'Address of a parameter (even an "in" parameter) -- to get a pointer to the actual object. -- If there is any danger that it will not be passed by reference, -- we will need to enclose the "sem_t" value as an aliased component of a -- record or even of a tagged type. type Dummy is tagged null record; type Semaphore is record Sem : aliased POSIX.C.sem_t; -- to force by-reference parameter mode: D : Dummy; end record; -- The "access constant" is sometimes a lie, but it allows -- us to emulate the POSIX C-language interface without violating -- Ada rules about pointers to variables vs. pointers to constants. type Semaphore_Descriptor is access constant POSIX.C.sem_t; pragma Convention (C, Semaphore_Descriptor); end POSIX.Semaphores; florist-gpl-2017-src/libsrc/posix-memory_locking.ads0000644000076700001450000000643413106553472022151 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . M E M O R Y _ L O C K I N G -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX, POSIX.C; package POSIX.Memory_Locking is type Memory_Locking_Options is new POSIX.Option_Set; Current_Pages : constant Memory_Locking_Options; Future_Pages : constant Memory_Locking_Options; procedure Lock_All (Options : Memory_Locking_Options); procedure Unlock_All; private Current_Pages : constant Memory_Locking_Options := Memory_Locking_Options (Option_Set'(Option => POSIX.C.MCL_CURRENT)); Future_Pages : constant Memory_Locking_Options := Memory_Locking_Options (Option_Set'(Option => POSIX.C.MCL_FUTURE)); end POSIX.Memory_Locking; florist-gpl-2017-src/libsrc/posix_process_identification.ads0000644000076700001450000000570313106553472023742 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ P R O C E S S _ I D E N T I F I C A T I O N -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Process_Identification; pragma Elaborate_All (POSIX.Process_Identification); package POSIX_Process_Identification renames POSIX.Process_Identification; florist-gpl-2017-src/libsrc/posix-process_environment.ads0000644000076700001450000001334613106553472023235 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P R O C E S S _ E N V I R O N M E N T -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with Unchecked_Conversion; package POSIX.Process_Environment is pragma Elaborate_Body; -- Process Parameters function Argument_List return POSIX.POSIX_String_List; -- .... Change POSIX.5? -- By rights, this function should have been a procedure. -- As a function, it is very awkward, since the type POSIX_String_List -- is limited (i.e. we cannot assign the value returned by the -- function above). Not only is this inefficient, it forces storage -- leakage, unless we implement POSIX_String_List as a controlled type -- with automatic storage reclamation -- which is still less efficient, -- and which nullifies the original reason for making POSIX_String_List -- a limited type! -- Environment Variables type Environment is limited private; procedure Copy_From_Current_Environment (Env : in out Environment); procedure Copy_To_Current_Environment (Env : Environment); procedure Copy_Environment (Source : Environment; Target : in out Environment); function Environment_Value_Of (Name : POSIX.POSIX_String; Env : Environment; Undefined : POSIX.POSIX_String := "") return POSIX.POSIX_String; function Environment_Value_Of (Name : POSIX.POSIX_String; Undefined : POSIX.POSIX_String := "") return POSIX.POSIX_String; function Is_Environment_Variable (Name : POSIX.POSIX_String; Env : Environment) return Boolean; function Is_Environment_Variable (Name : POSIX.POSIX_String) return Boolean; procedure Clear_Environment (Env : in out Environment); procedure Clear_Environment; procedure Set_Environment_Variable (Name : POSIX.POSIX_String; Value : POSIX.POSIX_String; Env : in out Environment); procedure Set_Environment_Variable (Name : POSIX.POSIX_String; Value : POSIX.POSIX_String); procedure Delete_Environment_Variable (Name : POSIX.POSIX_String; Env : in out Environment); procedure Delete_Environment_Variable (Name : POSIX.POSIX_String); function Length (Env : Environment) return Natural; function Length return Natural; generic with procedure Action (Name : POSIX.POSIX_String; Value : POSIX.POSIX_String; Quit : in out Boolean); procedure For_Every_Environment_Variable (Env : Environment); generic with procedure Action (Name : POSIX.POSIX_String; Value : POSIX.POSIX_String; Quit : in out Boolean); procedure For_Every_Current_Environment_Variable; -- Process Working Directory procedure Change_Working_Directory (Directory_Name : POSIX.Pathname); function Get_Working_Directory return POSIX.Pathname; private type Environment_List; type Environment is access Environment_List; function To_Environment is new Unchecked_Conversion (POSIX_String_List, Environment); function To_POSIX_String_List is new Unchecked_Conversion (Environment, POSIX_String_List); end POSIX.Process_Environment; florist-gpl-2017-src/libsrc/posix-memory_locking.adb0000644000076700001450000000704213106553472022124 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . M E M O R Y _ L O C K I N G -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation; package body POSIX.Memory_Locking is use POSIX.C; use POSIX.Implementation; ---------------- -- Lock_All -- ---------------- procedure Lock_All (Options : Memory_Locking_Options) is function mlockall (flag : int) return int; pragma Import (C, mlockall, mlockall_LINKNAME); begin Check (mlockall (int (Option_Set (Options).Option))); end Lock_All; ------------------ -- Unlock_All -- ------------------ procedure Unlock_All is function munlockall return int; pragma Import (C, munlockall, munlockall_LINKNAME); begin Check (munlockall); end Unlock_All; end POSIX.Memory_Locking; florist-gpl-2017-src/libsrc/posix-calendar.adb0000644000076700001450000001676513106553472020673 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . C A L E N D A R -- -- -- -- B o d y -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- Copyright (C) 1998-2012, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- Note: we used to call c_time in order to keep some compatibility with -- POSIX.Files.Set_File_Times, but this seems obsolete now with modern -- file systems, and having a fine grain precision is more important anyway. with Unchecked_Conversion; package body POSIX.Calendar is package AC renames Standard.Calendar; use Standard.Calendar; POSIX_Epoch : constant Duration := AC.Time_Of (Year => 2150, Month => 1, Day => 1) - AC.Time_Of (Year => 1970, Month => 1, Day => 1); -- Time difference between POSIX and GNAT notion of time, measured as a -- duration since the Ada mid point pragma Warnings (Off); -- Disable warning that the representation of Time values may -- change between GNAT versions. function Duration_To_POSIX_Time is new Unchecked_Conversion (Duration, POSIX_Time); function POSIX_Time_To_Duration is new Unchecked_Conversion (POSIX_Time, Duration); pragma Warnings (On); ------------- -- Clock -- ------------- function Clock return POSIX_Time is begin return To_POSIX_Time (AC.Clock); end Clock; --------------- -- To_Time -- --------------- function To_Time (Date : POSIX_Time) return AC.Time is begin return AC.Time (Date) - POSIX_Epoch; end To_Time; --------------------- -- To_POSIX_Time -- --------------------- function To_POSIX_Time (Date : AC.Time) return POSIX_Time is begin return POSIX_Time (Date + POSIX_Epoch); end To_POSIX_Time; ------------ -- Year -- ------------ function Year (Date : POSIX_Time) return Year_Number is begin return Year_Number (AC.Year (To_Time (Date))); end Year; ------------- -- Month -- ------------- function Month (Date : POSIX_Time) return Month_Number is begin return AC.Month (To_Time (Date)); end Month; ----------- -- Day -- ----------- function Day (Date : POSIX_Time) return Day_Number is begin return AC.Day (To_Time (Date)); end Day; --------------- -- Seconds -- --------------- function Seconds (Date : POSIX_Time) return Day_Duration is begin return AC.Seconds (To_Time (Date)); end Seconds; ------------- -- Split -- ------------- procedure Split (Date : POSIX_Time; Year : out Year_Number; Month : out Month_Number; Day : out Day_Number; Seconds : out Day_Duration) is begin AC.Split (To_Time (Date), Year, Month, Day, Seconds); end Split; --------------- -- Time_Of -- --------------- function Time_Of (Year : Year_Number; Month : Month_Number; Day : Day_Number; Seconds : Day_Duration := 0.0) return POSIX_Time is begin return To_POSIX_Time (AC.Time_Of (Year, Month, Day, Seconds)); end Time_Of; ----------- -- "+" -- ----------- function "+" (L : POSIX_Time; R : Duration) return POSIX_Time is begin return To_POSIX_Time (To_Time (L) + R); end "+"; ----------- -- "+" -- ----------- function "+" (L : Duration; R : POSIX_Time) return POSIX_Time is begin return To_POSIX_Time (L + To_Time (R)); end "+"; ----------- -- "-" -- ----------- function "-" (L : POSIX_Time; R : Duration) return POSIX_Time is begin return To_POSIX_Time (To_Time (L) - R); end "-"; ----------- -- "-" -- ----------- function "-" (L : POSIX_Time; R : POSIX_Time) return Duration is begin return To_Time (L) - To_Time (R); end "-"; ----------- -- "<" -- ----------- function "<" (L, R : POSIX_Time) return Boolean is begin return To_Time (L) < To_Time (R); end "<"; ------------ -- "<=" -- ------------ function "<=" (L, R : POSIX_Time) return Boolean is begin return To_Time (L) <= To_Time (R); end "<="; ----------- -- ">" -- ----------- function ">" (L, R : POSIX_Time) return Boolean is begin return To_Time (L) > To_Time (R); end ">"; ------------ -- ">=" -- ------------ function ">=" (L, R : POSIX_Time) return Boolean is begin return To_Time (L) >= To_Time (R); end ">="; --------------------- -- To_POSIX_Time -- --------------------- function To_POSIX_Time (Date : POSIX.Timespec) return POSIX_Time is begin return Duration_To_POSIX_Time (POSIX.To_Duration (Date)); end To_POSIX_Time; ------------------- -- To_Timespec -- ------------------- function To_Timespec (Date : POSIX_Time) return POSIX.Timespec is begin return POSIX.To_Timespec (POSIX_Time_To_Duration (Date)); end To_Timespec; end POSIX.Calendar; florist-gpl-2017-src/libsrc/posix_configurable_file_limits.ads0000644000076700001450000000603213106553472024227 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ C O N F I G U R A B L E _ F I L E _ L I M I T S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 1991-1994 Florida State University -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Configurable_File_Limits; pragma Elaborate_All (POSIX.Configurable_File_Limits); package POSIX_Configurable_File_Limits renames POSIX.Configurable_File_Limits; florist-gpl-2017-src/libsrc/posix-supplement_to_ada_io.adb0000644000076700001450000001313613106553472023301 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . S U P P L E M E N T _ T O _ A D A _ I O -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- .... This cannot be fully implemented without special support -- from the implementation of the package Ada.Text_IO. -- The present version is just a stub. A true implementation -- will apparently need to coordinate with -- the implementation of the standard Ada IO packages, e.g. -- System.File_Control_Block -- System.File_IO -- System.Direct_IO -- System.Sequential_IO -- Interfaces.C_Streams -- The modifications we need to make to those packages will -- need coordination with ACT. with POSIX.Implementation, Interfaces.C_Streams, System.File_Control_Block, System.File_IO, Unchecked_Conversion; package body POSIX.Supplement_to_Ada_IO is use Interfaces.C_Streams; use POSIX.Implementation; subtype System_File_Type is System.File_Control_Block.AFCB_Ptr; function Form_String (Val : Form_Values_for_Open) return String is pragma Unreferenced (Val); begin Raise_POSIX_Error (Operation_Not_Supported); return ""; end Form_String; function Form_Value (Str : String) return Form_Values_for_Open is pragma Unreferenced (Str); A : Form_Values_for_Open; begin Raise_POSIX_Error (Operation_Not_Supported); return A; end Form_Value; function Form_String (Val : Form_Values_for_Create) return String is pragma Unreferenced (Val); begin Raise_POSIX_Error (Operation_Not_Supported); return ""; end Form_String; function Form_Value (Str : String) return Form_Values_for_Create is pragma Unreferenced (Str); A : Form_Values_for_Create; begin Raise_POSIX_Error (Operation_Not_Supported); return A; end Form_Value; -- .... We may be able to implement Flush_All, using the open file -- chain, which is maintained by System.File_IO. procedure Flush_All is begin Raise_POSIX_Error (Operation_Not_Supported); end Flush_All; procedure Flush_Text_IO (File : Ada.Text_IO.File_Type) is begin Ada.Text_IO.Flush (File); end Flush_Text_IO; procedure Flush_Sequential_IO (File : File_Type) is function To_SFT is new Unchecked_Conversion (File_Type, System_File_Type); F : System_File_Type; Ret : int; pragma Unreferenced (Ret); begin F := To_SFT (File); System.File_IO.Check_File_Open (F); Ret := fflush (F.Stream); end Flush_Sequential_IO; procedure Flush_Direct_IO (File : File_Type) is function To_SFT is new Unchecked_Conversion (File_Type, System_File_Type); F : System_File_Type; Ret : int; pragma Unreferenced (Ret); begin F := To_SFT (File); System.File_IO.Check_File_Open (F); Ret := fflush (F.Stream); end Flush_Direct_IO; end POSIX.Supplement_to_Ada_IO; florist-gpl-2017-src/libsrc/posix-files.adb0000644000076700001450000004213213106553472020207 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . F I L E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation, POSIX.File_Status, POSIX.Permissions.Implementation, Unchecked_Conversion; package body POSIX.Files is use POSIX, POSIX.C, POSIX.Implementation, POSIX.Permissions.Implementation; ------------------------- -- Local Subprograms -- ------------------------- pragma Warnings (Off); -- Disable warning that the representation of Time values may -- change between GNAT versions. function To_D_Int is new Unchecked_Conversion (POSIX.Calendar.POSIX_Time, D_Int); function To_time_t (Time : POSIX.Calendar.POSIX_Time) return time_t; function To_time_t (Time : POSIX.Calendar.POSIX_Time) return time_t is begin return time_t (To_Duration (To_D_Int (Time) / NS_per_S) * NS_per_S); end To_time_t; pragma Warnings (On); function c_access (path : char_ptr; amode : int) return int; pragma Import (C, c_access, access_LINKNAME); function Form_C_access (Modes : POSIX.Files.Access_Mode_Set) return int; function Form_C_access (Modes : POSIX.Files.Access_Mode_Set) return int is c_access : Bits := 0; begin if Modes (Read_Ok) then c_access := c_access or R_OK; end if; if Modes (Write_Ok) then c_access := c_access or W_OK; end if; if Modes (Execute_Ok) then c_access := c_access or X_OK; end if; return int (c_access); end Form_C_access; ------------------------ -- Create_Directory -- ------------------------ function mkdir (path : char_ptr; mode : mode_t) return int; pragma Import (C, mkdir, mkdir_LINKNAME); procedure Create_Directory (Pathname : POSIX.Pathname; Permission : POSIX.Permissions.Permission_Set) is Pathname_With_NUL : POSIX_String := Pathname & NUL; begin Check (mkdir (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, (Form_C_Permission (Permission)))); end Create_Directory; ------------------- -- Create_FIFO -- ------------------- function mkfifo (path : char_ptr; mode : mode_t) return int; pragma Import (C, mkfifo, mkfifo_LINKNAME); procedure Create_FIFO (Pathname : POSIX.Pathname; Permission : POSIX.Permissions.Permission_Set) is Pathname_With_NUL : POSIX_String := Pathname & NUL; begin Check (mkfifo (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, (Form_C_Permission (Permission)))); end Create_FIFO; -------------- -- Unlink -- -------------- function unlink (path : char_ptr) return int; pragma Import (C, unlink, unlink_LINKNAME); procedure Unlink (Pathname : POSIX.Pathname) is Pathname_With_NUL : POSIX_String := Pathname & NUL; begin Check (unlink (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access)); end Unlink; ------------------------ -- Remove_Directory -- ------------------------ function rmdir (path : char_ptr) return int; pragma Import (C, rmdir, rmdir_LINKNAME); procedure Remove_Directory (Pathname : POSIX.Pathname) is Pathname_With_NUL : POSIX_String := Pathname & NUL; begin Check (rmdir (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access)); end Remove_Directory; ------------------------ -- Is_Symbolic_Link -- ------------------------ function Is_Symbolic_Link (Pathname : POSIX.Pathname) return Boolean is stat : POSIX.File_Status.Status; begin stat := POSIX.File_Status.Get_Link_Status (Pathname); return (POSIX.File_Status.Is_Symbolic_Link (stat)); exception when POSIX_Error => return False; end Is_Symbolic_Link; --------------- -- Is_File -- --------------- function Is_File (Pathname : POSIX.Pathname) return Boolean is stat : POSIX.File_Status.Status; begin stat := POSIX.File_Status.Get_File_Status (Pathname); return (POSIX.File_Status.Is_Regular_File (stat)); exception when POSIX_Error => return False; end Is_File; ----------------- -- Is_Socket -- ----------------- function Is_Socket (Pathname : POSIX.Pathname) return Boolean is stat : POSIX.File_Status.Status; begin stat := POSIX.File_Status.Get_File_Status (Pathname); return (POSIX.File_Status.Is_Socket (stat)); exception when POSIX_Error => return False; end Is_Socket; -------------------- -- Is_Directory -- -------------------- function Is_Directory (Pathname : POSIX.Pathname) return Boolean is stat : POSIX.File_Status.Status; begin stat := POSIX.File_Status.Get_File_Status (Pathname); return (POSIX.File_Status.Is_Directory (stat)); exception when POSIX_Error => return False; end Is_Directory; --------------- -- Is_FIFO -- --------------- function Is_FIFO (Pathname : POSIX.Pathname) return Boolean is stat : POSIX.File_Status.Status; begin stat := POSIX.File_Status.Get_File_Status (Pathname); return (POSIX.File_Status.Is_FIFO (stat)); exception when POSIX_Error => return False; end Is_FIFO; --------------------------------- -- Is_Character_Special_File -- --------------------------------- function Is_Character_Special_File (Pathname : POSIX.Pathname) return Boolean is stat : POSIX.File_Status.Status; begin stat := POSIX.File_Status.Get_File_Status (Pathname); return (POSIX.File_Status.Is_Character_Special_File (stat)); exception when POSIX_Error => return False; end Is_Character_Special_File; ----------------------------- -- Is_Block_Special_File -- ----------------------------- function Is_Block_Special_File (Pathname : POSIX.Pathname) return Boolean is stat : POSIX.File_Status.Status; begin stat := POSIX.File_Status.Get_File_Status (Pathname); return (POSIX.File_Status.Is_Block_Special_File (stat)); exception when POSIX_Error => return False; end Is_Block_Special_File; ------------ -- Link -- ------------ function link (existing : char_ptr; new_name : char_ptr) return int; pragma Import (C, link, link_LINKNAME); procedure Link (Old_Pathname : Pathname; New_Pathname : Pathname) is Old_Pathname_With_NUL : POSIX_String := Old_Pathname & NUL; New_Pathname_With_NUL : POSIX_String := New_Pathname & NUL; begin Check (link (Old_Pathname_With_NUL (Old_Pathname_With_NUL'First)'Unchecked_Access, New_Pathname_With_NUL (New_Pathname_With_NUL'First)'Unchecked_Access)); end Link; -------------- -- Rename -- -------------- function rename (old_name : char_ptr; new_name : char_ptr) return int; pragma Import (C, rename, rename_LINKNAME); procedure Rename (Old_Pathname : Pathname; New_Pathname : Pathname) is Old_Pathname_With_NUL : POSIX_String := Old_Pathname & NUL; New_Pathname_With_NUL : POSIX_String := New_Pathname & NUL; begin Check (rename (Old_Pathname_With_NUL (Old_Pathname_With_NUL'First)'Unchecked_Access, New_Pathname_With_NUL (New_Pathname_With_NUL'First)'Unchecked_Access)); end Rename; ------------------- -- Filename_Of -- ------------------- function Filename_Of (D_Entry : Directory_Entry) return Filename is begin return Form_POSIX_String (To_char_ptr (D_Entry.d_name (1)'Address)); end Filename_Of; --------------------------------- -- For_Every_Directory_Entry -- --------------------------------- function opendir (dirname : char_ptr) return DIR_ptr; pragma Import (C, opendir, opendir_LINKNAME); function readdir (dirp : DIR_ptr) return dirent_ptr; pragma Import (C, readdir, readdir_LINKNAME); function closedir (dirp : DIR_ptr) return int; pragma Import (C, closedir, closedir_LINKNAME); -- ????? -- The following needs to be made safe for use in a multitasking -- environment. -- Clearly, readdir is a problem, since it returns a pointer to a -- structure that must be allocated somewhere. Thus, POSIX provides -- readdir_r. We should probably add conditional compilation code to -- Florist posix-files.adb to make use of readdir_r if that is -- supported. -- Note that we are not required to support safe concurrent use of -- multiple iterators on the same directory. A non-normative note -- has been placed in 3.3.5 on lines 19-22 to make this clear. It -- says: -- The requirement for tasking safety does not imply any greater -- degree of safety for concurrent use than is requird of the -- standard Ada libraries by the Ada RM. That is, unless it is so -- specified elsewhere in this standard, operations are [missin "not" -- here, which is a typo] necessarily atomic and are not necessarily -- safe to execute concurrently on the same data object. -- Thus, the thing is to cover the case where readdir is the only -- thing available, and it is not safe for concurrent use (even on -- different directories). procedure For_Every_Directory_Entry (Pathname : POSIX.Pathname) is Pathname_With_NUL : POSIX_String := Pathname & NUL; dirp : DIR_ptr; dirent : dirent_ptr; Quit : Boolean := False; rc : int; pragma Unreferenced (rc); begin dirp := opendir (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access); if dirp = null then Raise_POSIX_Error; end if; loop dirent := readdir (dirp); exit when dirent = null; Action (Directory_Entry (dirent), Quit); exit when Quit; end loop; Check (closedir (dirp)); exception when others => -- Ensure dirp is closed if an exception is raised. if dirp /= null then -- Do not call Check here, as that function may raise -- POSIX_Error and obscure an underlying problem raised -- in the procedure Action. rc := closedir (dirp); end if; raise; end For_Every_Directory_Entry; ------------------------------ -- Change_Owner_And_Group -- ------------------------------ function chown (path : char_ptr; owner : uid_t; group : gid_t) return int; pragma Import (C, chown, chown_LINKNAME); function To_uid_t is new Unchecked_Conversion (POSIX.Process_Identification.User_ID, uid_t); function To_gid_t is new Unchecked_Conversion (POSIX.Process_Identification.Group_ID, gid_t); procedure Change_Owner_And_Group (Pathname : POSIX.Pathname; Owner : POSIX.Process_Identification.User_ID; Group : POSIX.Process_Identification.Group_ID) is Pathname_With_NUL : POSIX_String := Pathname & NUL; begin Check (chown (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, To_uid_t (Owner), To_gid_t (Group))); end Change_Owner_And_Group; -------------------------- -- Change_Permissions -- -------------------------- function chmod (path : char_ptr; mode : mode_t) return int; pragma Import (C, chmod, chmod_LINKNAME); procedure Change_Permissions (Pathname : POSIX.Pathname; Permission : POSIX.Permissions.Permission_Set) is Pathname_With_NUL : POSIX_String := Pathname & NUL; begin Check (chmod (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, Form_C_Permission (Permission))); end Change_Permissions; ---------------------- -- Set_File_Times -- ---------------------- -- There is a problem in the difference between POSIX.1c and POSIX.5 -- definition of file related times. POSIX.1c requires the accuracy be -- in seconds while POSIX.5 requires it to be in POSIX_Time. -- To avoid inconsistency, we have implemented POSIX_Time so that -- all time values are truncated to the nearest second. function utime (path : char_ptr; actime : utimbuf_ptr) return int; pragma Import (C, utime, utime_LINKNAME); procedure Set_File_Times (Pathname : POSIX.Pathname; Access_Time : POSIX.Calendar.POSIX_Time; Modification_Time : POSIX.Calendar.POSIX_Time) is Pathname_With_NUL : POSIX_String := Pathname & NUL; Times : aliased struct_utimbuf; begin Times.actime := To_time_t (Access_Time); Times.modtime := To_time_t (Modification_Time); Check (utime (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, Times'Unchecked_Access)); end Set_File_Times; ---------------------- -- Set_File_Times -- ---------------------- procedure Set_File_Times (Pathname : POSIX.Pathname) is Pathname_With_NUL : POSIX_String := Pathname & NUL; begin Check (utime (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, null)); end Set_File_Times; --------------------- -- Is_Accessible -- --------------------- function Is_Accessible (Pathname : POSIX.Pathname; Access_Modes : Access_Mode_Set) return Boolean is begin return Accessibility (Pathname, Access_Modes) = No_Error; end Is_Accessible; ----------------------- -- Accessibilitity -- ----------------------- function Accessibility (Pathname : POSIX.Pathname; Access_Modes : Access_Mode_Set) return Error_Code is Pathname_With_NUL : POSIX_String := Pathname & NUL; begin if c_access (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, Form_C_access (Access_Modes)) = 0 then return No_Error; else return Fetch_Errno; end if; end Accessibility; ----------------------- -- Is_File_Present -- ----------------------- function Is_File_Present (Pathname : POSIX.Pathname) return Boolean is Pathname_With_NUL : POSIX_String := Pathname & NUL; begin return c_access (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, 0) = 0; end Is_File_Present; ----------------- -- Existence -- ----------------- function Existence (Pathname : POSIX.Pathname) return Error_Code is begin if Is_File_Present (Pathname) then return No_Error; else return Fetch_Errno; end if; end Existence; end POSIX.Files; florist-gpl-2017-src/libsrc/posix-configurable_system_limits.adb0000644000076700001450000003122413106553472024532 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . C O N F I G U R A B L E _ S Y S T E M _ L I M I T S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX; package body POSIX.Configurable_System_Limits is package PO renames POSIX.Options; package PL renames POSIX.Limits; use POSIX.C; function sysconf (c_name : int) return long; pragma Import (C, sysconf, sysconf_LINKNAME); generic type Support_Subtype is range <>; Name : int; function Limit return Support_Subtype; function Limit return Support_Subtype is Result : long; begin Result := sysconf (Name); if Result = -1 then return Support_Subtype'Last; end if; return Support_Subtype (Result); end Limit; function Asynchronous_IO_Is_Supported return PO.Asynchronous_IO_Support is begin return sysconf (SC_ASYNCHRONOUS_IO) = 1; end Asynchronous_IO_Is_Supported; function File_Synchronization_Is_Supported return PO.File_Synchronization_Support is begin return sysconf (SC_FSYNC) = 1; end File_Synchronization_Is_Supported; function Job_Control_Supported return Job_Control_Support is begin return sysconf (SC_JOB_CONTROL) = 1; end Job_Control_Supported; function Memory_Mapped_Files_Are_Supported return PO.Memory_Mapped_Files_Support is begin return sysconf (SC_MAPPED_FILES) = 1; end Memory_Mapped_Files_Are_Supported; function Memory_Locking_Is_Supported return PO.Memory_Locking_Support is begin return sysconf (SC_MEMLOCK) = 1; end Memory_Locking_Is_Supported; function Memory_Range_Locking_Is_Supported return PO.Memory_Range_Locking_Support is begin return sysconf (SC_MEMLOCK_RANGE) = 1; end Memory_Range_Locking_Is_Supported; function Memory_Protection_Is_Supported return PO.Memory_Protection_Support is begin return sysconf (SC_MEMORY_PROTECTION) = 1; end Memory_Protection_Is_Supported; function Message_Queues_Are_Supported return PO.Message_Queues_Support is begin return sysconf (SC_MESSAGE_PASSING) = 1; end Message_Queues_Are_Supported; function Mutex_Priority_Ceiling_Is_Supported return PO.Mutex_Priority_Ceiling_Support is begin return sysconf (SC_THREAD_PRIO_PROTECT) = 1; end Mutex_Priority_Ceiling_Is_Supported; function Mutex_Priority_Inheritance_Is_Supported return PO.Mutex_Priority_Inheritance_Support is begin return sysconf (SC_THREAD_PRIO_INHERIT) = 1; end Mutex_Priority_Inheritance_Is_Supported; function Mutexes_Are_Supported return PO.Mutexes_Support is begin return True; end Mutexes_Are_Supported; function Prioritized_IO_Is_Supported return PO.Prioritized_IO_Support is begin return sysconf (SC_PRIORITIZED_IO) = 1; end Prioritized_IO_Is_Supported; function Priority_Process_Scheduling_Is_Supported return PO.Priority_Process_Scheduling_Support is begin return sysconf (SC_PRIORITY_SCHEDULING) = 1; end Priority_Process_Scheduling_Is_Supported; function Priority_Task_Scheduling_Is_Supported return PO.Priority_Task_Scheduling_Support is begin return sysconf (SC_THREAD_PRIORITY_SCHEDULING) = 1; end Priority_Task_Scheduling_Is_Supported; function Realtime_Signals_Are_Supported return PO.Realtime_Signals_Support is begin return sysconf (SC_REALTIME_SIGNALS) = 1; end Realtime_Signals_Are_Supported; function Saved_IDs_Supported return PO.Saved_IDs_Support is begin return sysconf (SC_SAVED_IDS) = 1; end Saved_IDs_Supported; function Semaphores_Are_Supported return PO.Semaphores_Support is begin return sysconf (SC_SEMAPHORES) = 1; end Semaphores_Are_Supported; function Shared_Memory_Objects_Are_Supported return PO.Shared_Memory_Objects_Support is begin return sysconf (SC_SHARED_MEMORY_OBJECTS) = 1; end Shared_Memory_Objects_Are_Supported; function Process_Shared_Is_Supported return PO.Process_Shared_Support is begin return sysconf (SC_THREAD_PROCESS_SHARED) = 1; end Process_Shared_Is_Supported; function Synchronized_IO_Is_Supported return PO.Synchronized_IO_Support is begin return sysconf (SC_SYNCHRONIZED_IO) = 1; end Synchronized_IO_Is_Supported; function Timers_Are_Supported return PO.Timers_Support is begin return sysconf (SC_TIMERS) = 1; end Timers_Are_Supported; function System_POSIX_Version return POSIX_Version is begin return POSIX_Version (sysconf (SC_VERSION)); end System_POSIX_Version; function System_POSIX_Ada_Version return POSIX_Version is begin return POSIX_Ada_Version; end System_POSIX_Ada_Version; function ALM is new Limit (PL.Argument_List_Maxima, SC_ARG_MAX); function Argument_List_Maximum return POSIX.Limits.Argument_List_Maxima renames ALM; function AIOM is new Limit (PL.Asynchronous_IO_Maxima, SC_AIO_MAX); function Asynchronous_IO_Maximum return PL.Asynchronous_IO_Maxima renames AIOM; function AIOPDM is new Limit (PL.Asynchronous_IO_Priority_Delta_Maxima, SC_AIO_PRIO_DELTA_MAX); function Asynchronous_IO_Priority_Delta_Maximum return PL.Asynchronous_IO_Priority_Delta_Maxima renames AIOPDM; function CPM is new Limit (PL.Child_Processes_Maxima, SC_CHILD_MAX); function Child_Processes_Maximum return PL.Child_Processes_Maxima renames CPM; function GM is new Limit (PL.Groups_Maxima, SC_NGROUPS_MAX); function Groups_Maximum return PL.Groups_Maxima renames GM; function LIOM is new Limit (PL.List_IO_Maxima, SC_AIO_LISTIO_MAX); function List_IO_Maximum return PL.List_IO_Maxima renames LIOM; function OMQM is new Limit (PL.Open_Message_Queues_Maxima, SC_MQ_OPEN_MAX); function Open_Message_Queues_Maximum return PL.Open_Message_Queues_Maxima renames OMQM; function MPM is new Limit (PL.Message_Priority_Maxima, SC_MQ_PRIO_MAX); function Message_Priority_Maximum return PL.Message_Priority_Maxima renames MPM; function OFM is new Limit (PL.Open_Files_Maxima, SC_OPEN_MAX); function Open_Files_Maximum return PL.Open_Files_Maxima renames OFM; function PSR is new Limit (PL.Page_Size_Range, SC_PAGESIZE); function Page_Size return PL.Page_Size_Range renames PSR; function QSM is new Limit (PL.Queued_Signals_Maxima, SC_SIGQUEUE_MAX); function Queued_Signals_Maximum return PL.Queued_Signals_Maxima renames QSM; function RSM is new Limit (PL.Realtime_Signals_Maxima, SC_RTSIG_MAX); function Realtime_Signals_Maximum return PL.Realtime_Signals_Maxima renames RSM; function SEM is new Limit (PL.Semaphores_Maxima, SC_SEM_NSEMS_MAX); function Semaphores_Maximum return PL.Semaphores_Maxima renames SEM; function SVM is new Limit (PL.Semaphores_Value_Maxima, SC_SEM_VALUE_MAX); function Semaphores_Value_Maximum return PL.Semaphores_Value_Maxima renames SVM; function STM is new Limit (PL.Streams_Maxima, SC_STREAM_MAX); function Stream_Maximum return PL.Streams_Maxima renames STM; function TM is new Limit (PL.Timers_Maxima, SC_TIMER_MAX); function Timers_Maximum return PL.Timers_Maxima renames TM; function TOM is new Limit (PL.Timer_Overruns_Maxima, SC_DELAYTIMER_MAX); function Timer_Overruns_Maximum return PL.Timer_Overruns_Maxima renames TOM; function TZSM is new Limit (PL.Time_Zone_String_Maxima, SC_TZNAME_MAX); function Time_Zone_String_Maximum return PL.Time_Zone_String_Maxima renames TZSM; -- additions from POSIX.5c [D2] -- POSIX.5c/D4 extensions function Internet_Datagram_Is_Supported return POSIX.Options.Internet_Datagram_Support is begin return sysconf (SC_PII_INTERNET_DGRAM) = 1; end Internet_Datagram_Is_Supported; function Internet_Protocol_Is_Supported return POSIX.Options.Internet_Protocol_Support is begin return sysconf (SC_PII_INTERNET) = 1; end Internet_Protocol_Is_Supported; function Internet_Stream_Is_Supported return POSIX.Options.Internet_Stream_Support is begin return sysconf (SC_PII_INTERNET_STREAM) = 1; end Internet_Stream_Is_Supported; function ISO_OSI_Protocol_Is_Supported return POSIX.Options.ISO_OSI_Protocol_Support is begin return sysconf (SC_PII_OSI) = 1; end ISO_OSI_Protocol_Is_Supported; function Network_Management_Is_Supported return POSIX.Options.Network_Management_Support is begin return sysconf (SC_POSIX_PII_NET_SUPPORT) = 1; end Network_Management_Is_Supported; function OSI_Connectionless_Is_Supported return POSIX.Options.OSI_Connectionless_Support is begin return sysconf (SC_PII_OSI_CLTS) = 1; end OSI_Connectionless_Is_Supported; function OSI_Connection_Is_Supported return POSIX.Options.OSI_Connection_Support is begin return sysconf (SC_PII_OSI_COTS) = 1; end OSI_Connection_Is_Supported; function OSI_Minimal_Is_Supported return POSIX.Options.OSI_Minimal_Support is begin return sysconf (SC_PII_OSI_M) = 1; end OSI_Minimal_Is_Supported; function Poll_Is_Supported return POSIX.Options.Poll_Support is begin return sysconf (SC_POLL) = 1; end Poll_Is_Supported; function Select_Is_Supported return POSIX.Options.Select_Support is begin return sysconf (SC_SELECT) = 1; end Select_Is_Supported; function Sockets_DNI_Is_Supported return POSIX.Options.Sockets_DNI_Support is begin return sysconf (SC_PII_SOCKET) = 1; end Sockets_DNI_Is_Supported; function XTI_DNI_Is_Supported return POSIX.Options.XTI_DNI_Support is begin return sysconf (SC_PII_XTI) = 1; end XTI_DNI_Is_Supported; function SIOVM is new Limit (PL.Socket_IO_Vector_Maxima, SC_UIO_MAXIOV); function Socket_IO_Vector_Maximum return POSIX.Limits.Socket_IO_Vector_Maxima renames SIOVM; end POSIX.Configurable_System_Limits; florist-gpl-2017-src/libsrc/posix_group_database.ads0000644000076700001450000000564013106553472022173 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ G R O U P _ D A T A B A S E -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Group_Database; pragma Elaborate_All (POSIX.Group_Database); package POSIX_Group_Database renames POSIX.Group_Database; florist-gpl-2017-src/libsrc/posix-c.adb0000644000076700001450000001007513106553472017330 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . C -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with System.Storage_Elements; package body POSIX.C is use System.Storage_Elements; --------------- -- Advance -- --------------- procedure Advance (Ptr : in out char_ptr) is begin Ptr := To_Ptr (To_Address (Ptr) + char'Size / System.Storage_Unit); end Advance; procedure Advance (Ptr : in out char_ptr_ptr) is begin Ptr := To_Ptr (To_Address (Ptr) + char_ptr'Size / System.Storage_Unit); end Advance; ------------------------- -- Form_POSIX_String -- ------------------------- function strlen (str : char_ptr) return size_t; pragma Import (C, strlen, "strlen"); function Form_POSIX_String (Str : char_ptr) return POSIX.POSIX_String is begin if Str = null then return ""; end if; declare subtype POSIX_Substring is POSIX.POSIX_String (1 .. Integer (strlen (Str))); type POSIX_Substring_Ptr is access POSIX_Substring; pragma Warnings (Off); function char_ptr_to_pssptr is new Unchecked_Conversion (char_ptr, POSIX_Substring_Ptr); pragma Warnings (On); begin return char_ptr_to_pssptr (Str).all; end; end Form_POSIX_String; end POSIX.C; florist-gpl-2017-src/libsrc/posix-group_database.ads0000644000076700001450000001253613106553472022113 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . G R O U P _ D A T A B A S E -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX, POSIX.C, POSIX.Process_Identification; package POSIX.Group_Database is type Group_Database_Item is private; type Group_ID_List is private; -- operations to get information from a Group_Database_Item function Group_Name_Of (DB_Item : Group_Database_Item) return POSIX.POSIX_String; function Group_ID_Of (DB_Item : Group_Database_Item) return POSIX.Process_Identification.Group_ID; function Group_ID_List_Of (DB_Item : Group_Database_Item) return Group_ID_List; -- iterator over the Group_ID_List generic with procedure Action (ID : POSIX.POSIX_String; Quit : in out Boolean); procedure For_Every_Member (List : Group_ID_List); function Length (Member_List : Group_ID_List) return Natural; -- operations to get a Group_Database_Item function Get_Group_Database_Item (GID : POSIX.Process_Identification.Group_ID) return Group_Database_Item; function Get_Group_Database_Item (Name : POSIX.POSIX_String) return Group_Database_Item; private -- .... Change POSIX.5b? -- For correct tasking-safe operation, without storage leakage, -- we want to make a copy of the entire group database item -- inside each value of type Group_Database_Item. -- The problem is that there is no fixed size, -- so we would like to make the size depend on a discriminant. -- We can't do this, as the interface stands. -- This leaves us few options: -- (a) impose a fixed size limit, which might overflow; -- (b) use dynamic allocation, risking storage leakage; -- (c) use the raw C interfaces, risking tasking unsafety -- and also storage leakage. -- Note that using the new thread-safe operations, -- getgrgid_r and getgrnam_r, does not solve our problem, -- since we would still have to provide space to hold the strings. -- We choose to use the raw C interfaces, since the other -- alternatives are not significantly more attractive. -- See also POSIX.User_Database. -- .... Another modification we want to make in POSIX.5b is to -- make types "limited private" where appropriate. For example, we -- do not want to compare the whole contents of two lists using "=" -- operation if we want to follow the POSIX.1 definition of group -- structure. We could provide the operation, of course, with some -- expensive structures and operations. However, this is not worth -- especially when we could perform the same operation using other -- operations (For_Every_Member). type Group_Database_Item is new POSIX.C.group_ptr; type Group_ID_List is new POSIX.C.char_ptr_ptr; end POSIX.Group_Database; florist-gpl-2017-src/libsrc/posix-files.ads0000644000076700001450000001345713106553472020240 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . F I L E S -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX, POSIX.C, POSIX.Permissions, POSIX.Process_Identification, POSIX.Calendar; package POSIX.Files is -- Operations to Create Files in the File System procedure Create_Directory (Pathname : POSIX.Pathname; Permission : POSIX.Permissions.Permission_Set); procedure Create_FIFO (Pathname : POSIX.Pathname; Permission : POSIX.Permissions.Permission_Set); -- Operations to remove files from the File System procedure Unlink (Pathname : POSIX.Pathname); procedure Remove_Directory (Pathname : POSIX.Pathname); -- Predicates on files in the File System function Is_Block_Special_File (Pathname : POSIX.Pathname) return Boolean; function Is_Character_Special_File (Pathname : POSIX.Pathname) return Boolean; function Is_Directory (Pathname : POSIX.Pathname) return Boolean; function Is_FIFO (Pathname : POSIX.Pathname) return Boolean; -- Is_Symbolic_Link is not in the IEEE standard function Is_Symbolic_Link (Pathname : POSIX.Pathname) return Boolean; -- .... Change POSIX.5? -- Why is this not called Is_Regular_File? Add renaming decl? function Is_File (Pathname : POSIX.Pathname) return Boolean; -- Is_Socket is from POSIX.5c [D2] function Is_Socket (Pathname : POSIX.Pathname) return Boolean; -- Operations to modify File Pathnames procedure Link (Old_Pathname : POSIX.Pathname; New_Pathname : POSIX.Pathname); procedure Rename (Old_Pathname : POSIX.Pathname; New_Pathname : POSIX.Pathname); -- Iterating over files within a directory type Directory_Entry is limited private; function Filename_Of (D_Entry : Directory_Entry) return POSIX.Filename; pragma Inline (Filename_Of); generic with procedure Action (D_Entry : Directory_Entry; Quit : in out Boolean); procedure For_Every_Directory_Entry (Pathname : POSIX.Pathname); -- Operations to Update File Status Information procedure Change_Owner_And_Group (Pathname : POSIX.Pathname; Owner : POSIX.Process_Identification.User_ID; Group : POSIX.Process_Identification.Group_ID); procedure Change_Permissions (Pathname : POSIX.Pathname; Permission : POSIX.Permissions.Permission_Set); procedure Set_File_Times (Pathname : POSIX.Pathname; Access_Time : POSIX.Calendar.POSIX_Time; Modification_Time : POSIX.Calendar.POSIX_Time); procedure Set_File_Times (Pathname : POSIX.Pathname); -- Operations to Determine File Accessibility type Access_Mode is (Read_Ok, Write_Ok, Execute_Ok); type Access_Mode_Set is array (Access_Mode) of Boolean; function Is_Accessible (Pathname : POSIX.Pathname; Access_Modes : Access_Mode_Set) return Boolean; function Accessibility (Pathname : POSIX.Pathname; Access_Modes : Access_Mode_Set) return POSIX.Error_Code; function Is_File_Present (Pathname : POSIX.Pathname) return Boolean; function Existence (Pathname : POSIX.Pathname) return POSIX.Error_Code; private type Directory_Entry is new POSIX.C.dirent_ptr; end POSIX.Files; florist-gpl-2017-src/libsrc/posix-configurable_file_limits.ads0000644000076700001450000002206413106553472024150 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . C O N F I G U R A B L E _ F I L E _ L I M I T S -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX, POSIX.IO, POSIX.Limits, POSIX.Options; package POSIX.Configurable_File_Limits is function Link_Is_Limited (Pathname : POSIX.Pathname) -- obsolescent return Boolean; -- obsolescent function Link_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean; -- obsolescent function Link_Limit (Pathname : POSIX.Pathname) -- obsolescent return POSIX.Link_Limit_Maxima; -- obsolescent function Link_Limit (File : POSIX.IO.File_Descriptor) -- obsolescent return POSIX.Link_Limit_Maxima; -- obsolescent function Links_Are_Limited (Pathname : POSIX.Pathname) return Boolean renames Link_Is_Limited; function Links_Are_Limited (File : POSIX.IO.File_Descriptor) return Boolean renames Link_Is_Limited; function Links_Maximum (Pathname : POSIX.Pathname) return POSIX.Limits.Links_Maxima renames Link_Limit; function Links_Maximum (File : POSIX.IO.File_Descriptor) return POSIX.Limits.Links_Maxima renames Link_Limit; function Input_Line_Is_Limited (Pathname : POSIX.Pathname) return Boolean; function Input_Line_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean; function Input_Line_Limit (Pathname : POSIX.Pathname) -- obsolescent return POSIX.Input_Line_Limit_Maxima; -- obsolescent function Input_Line_Limit (File : POSIX.IO.File_Descriptor) return POSIX.Input_Line_Limit_Maxima; -- obsolescent function Input_Line_Maximum (Pathname : POSIX.Pathname) return POSIX.Limits.Input_Line_Maxima renames Input_Line_Limit; function Input_Line_Maximum (File : POSIX.IO.File_Descriptor) return POSIX.Limits.Input_Line_Maxima renames Input_Line_Limit; function Input_Queue_Is_Limited (Pathname : POSIX.Pathname) return Boolean; function Input_Queue_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean; function Input_Queue_Limit (Pathname : POSIX.Pathname) -- obsolescent return POSIX.Input_Queue_Limit_Maxima; -- obsolescent function Input_Queue_Limit (File : POSIX.IO.File_Descriptor) return POSIX.Input_Queue_Limit_Maxima; -- obsolescent function Input_Queue_Maximum (Pathname : POSIX.Pathname) return POSIX.Limits.Input_Queue_Maxima renames Input_Queue_Limit; function Input_Queue_Maximum (File : POSIX.IO.File_Descriptor) return POSIX.Limits.Input_Queue_Maxima renames Input_Queue_Limit; function Filename_Is_Limited (Pathname : POSIX.Pathname) return Boolean; function Filename_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean; function Filename_Limit (Pathname : POSIX.Pathname) -- obsolescent return POSIX.Filename_Limit_Maxima; -- obsolescent function Filename_Limit (File : POSIX.IO.File_Descriptor) return POSIX.Filename_Limit_Maxima; -- obsolescent function Filename_Maximum (Pathname : POSIX.Pathname) return POSIX.Limits.Filename_Maxima renames Filename_Limit; function Filename_Maximum (File : POSIX.IO.File_Descriptor) return POSIX.Limits.Filename_Maxima renames Filename_Limit; function Pathname_Is_Limited (Pathname : POSIX.Pathname) return Boolean; function Pathname_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean; function Pathname_Limit (Pathname : POSIX.Pathname) -- obsolescent return POSIX.Pathname_Limit_Maxima; -- obsolescent function Pathname_Limit (File : POSIX.IO.File_Descriptor) return POSIX.Pathname_Limit_Maxima; -- obsolescent function Pathname_Maximum (Pathname : POSIX.Pathname) return POSIX.Limits.Pathname_Maxima renames Pathname_Limit; function Pathname_Maximum (File : POSIX.IO.File_Descriptor) return POSIX.Limits.Pathname_Maxima renames Pathname_Limit; function Pipe_Length_Is_Limited (Pathname : POSIX.Pathname) return Boolean; function Pipe_Length_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean; function Pipe_Length_Limit (Pathname : POSIX.Pathname) -- obsolescent return POSIX.Pipe_Limit_Maxima; -- obsolescent function Pipe_Length_Limit (File : POSIX.IO.File_Descriptor) return POSIX.Pipe_Limit_Maxima; function Pipe_Length_Maximum (Pathname : POSIX.Pathname) return POSIX.Limits.Pipe_Length_Maxima renames Pipe_Length_Limit; function Pipe_Length_Maximum (File : POSIX.IO.File_Descriptor) return POSIX.Limits.Pipe_Length_Maxima renames Pipe_Length_Limit; function Change_Owner_Is_Restricted (Pathname : POSIX.Pathname) return POSIX.Options.Change_Owner_Restriction; function Change_Owner_Is_Restricted (File : POSIX.IO.File_Descriptor) return POSIX.Options.Change_Owner_Restriction; function Filename_Is_Truncated (Pathname : POSIX.Pathname) return POSIX.Options.Filename_Truncation; function Filename_Is_Truncated (File : POSIX.IO.File_Descriptor) return POSIX.Options.Filename_Truncation; function Synchronized_IO_Is_Supported (Pathname : POSIX.Pathname) return Boolean; function Synchronized_IO_Is_Supported (File : POSIX.IO.File_Descriptor) return Boolean; function Asynchronous_IO_Is_Supported (Pathname : POSIX.Pathname) return Boolean; function Asynchronous_IO_Is_Supported (File : POSIX.IO.File_Descriptor) return Boolean; function Prioritized_IO_Is_Supported (Pathname : POSIX.Pathname) return Boolean; function Prioritized_IO_Is_Supported (File : POSIX.IO.File_Descriptor) return Boolean; -- Additions from POSIX.5c [Draft 2] -- 5.4.1 Socket Buffer Limits from P1003.5c function Socket_Buffer_Is_Limited (File : POSIX.IO.File_Descriptor) return Boolean; function Socket_Buffer_Is_Limited (Pathname : POSIX.Pathname) return Boolean; -- The following deviate from POSIX.5c/D1 function Socket_Buffer_Limit (Pathname : POSIX.Pathname) return POSIX.Limits.Socket_Buffer_Maxima; function Socket_Buffer_Limit (File : POSIX.IO.File_Descriptor) return POSIX.Limits.Socket_Buffer_Maxima; -- Craig Meyers has in D1: -- function Socket_Buffer_Maximum -- return POSIX.Limits.Socket_Buffer_Maxima; end POSIX.Configurable_File_Limits; florist-gpl-2017-src/libsrc/posix-unsafe_process_primitives.ads0000644000076700001450000000702213106553472024417 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . U N S A F E _ P R O C E S S _ P R I M I T I V E S -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX, POSIX.Process_Environment, POSIX.Process_Identification; package POSIX.Unsafe_Process_Primitives is function Fork return POSIX.Process_Identification.Process_ID; procedure Exec (Pathname : POSIX.Pathname; Arg_List : POSIX.POSIX_String_List := POSIX.Empty_String_List; Env_List : POSIX.Process_Environment.Environment); procedure Exec (Pathname : POSIX.Pathname; Arg_List : POSIX.POSIX_String_List := POSIX.Empty_String_List); procedure Exec_Search (Filename : POSIX.Filename; Arg_List : POSIX.POSIX_String_List := POSIX.Empty_String_List; Env_List : POSIX.Process_Environment.Environment); procedure Exec_Search (Filename : POSIX.Filename; Arg_List : POSIX.POSIX_String_List := POSIX.Empty_String_List); end POSIX.Unsafe_Process_Primitives; florist-gpl-2017-src/libsrc/posix-macros-sockets.c0000644000076700001450000000102613106553473021534 0ustar gnatmailgnat/* file: posix-macros-sockets.c ---------------------------- These subprograms provide access to POSIX functionality that is provided for C programs via macros. */ /* #include #include */ #include "pconfig.h" unsigned long c_ntohl (unsigned long val) { return ntohl (val); } unsigned long c_htonl (unsigned long val) { return htonl (val); } unsigned short c_ntohs (unsigned short val) { return ntohs (val); } unsigned long c_htons (unsigned long val) { return htons (val); } florist-gpl-2017-src/libsrc/posix-file_locking.adb0000644000076700001450000001537213106553472021540 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . F I L E _ L O C K I N G -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.Implementation, Unchecked_Conversion; package body POSIX.File_Locking is use POSIX.C, POSIX.Implementation; function To_Process_ID is new Unchecked_Conversion (pid_t, POSIX.Process_Identification.Process_ID); C_Lock_Type : constant array (Lock_Kind) of short := (Read_Lock => F_RDLCK, Write_Lock => F_WRLCK, Unlock => F_UNLCK); C_Whence : constant array (POSIX.IO.Position) of short := (POSIX.IO.From_Beginning => SEEK_SET, POSIX.IO.From_End_Of_File => SEEK_END, POSIX.IO.From_Current_Position => SEEK_CUR); ---------------- -- Get_Lock -- ---------------- function fcntl (fd : int; cmd : int; arg : flock_ptr) return int; pragma Import (C, fcntl, fcntl_LINKNAME); procedure Get_Lock (File : POSIX.IO.File_Descriptor; Lock : File_Lock; Result : out File_Lock; Process : out POSIX.Process_Identification.Process_ID) is T : aliased struct_flock; Res : File_Lock (False); -- temporary is needed in case Result.Whole_File = True begin T.l_type := C_Lock_Type (Lock.Lock); if Lock.Whole_File then T.l_whence := SEEK_SET; T.l_start := 0; T.l_len := off_t (POSIX.IO.File_Size (File)); else T.l_whence := C_Whence (Lock.Starting_Point); T.l_start := off_t (Lock.Start); T.l_len := off_t (Lock.Length); end if; Check (fcntl (int (File), F_GETLK, T'Unchecked_Access)); if T.l_type = F_UNLCK then Process := POSIX.Process_Identification.Null_Process_ID; Res.Lock := Unlock; else Process := To_Process_ID (T.l_pid); if T.l_type = F_RDLCK then Res.Lock := Read_Lock; elsif T.l_type = F_WRLCK then Res.Lock := Write_Lock; else Res.Lock := Unlock; end if; if T.l_whence = SEEK_SET then Res.Starting_Point := POSIX.IO.From_Beginning; elsif T.l_whence = SEEK_END then Res.Starting_Point := POSIX.IO.From_End_Of_File; else Res.Starting_Point := POSIX.IO.From_Current_Position; end if; Res.Start := POSIX.IO.IO_Offset (T.l_start); Res.Length := IO_Count (T.l_len); end if; Result := Res; end Get_Lock; ---------------- -- Set_Lock -- ---------------- procedure Set_Lock (File : POSIX.IO.File_Descriptor; Lock : File_Lock) is T : aliased struct_flock; begin T.l_type := C_Lock_Type (Lock.Lock); if Lock.Whole_File then T.l_whence := SEEK_SET; T.l_start := 0; T.l_len := off_t (POSIX.IO.File_Size (File)); else T.l_whence := C_Whence (Lock.Starting_Point); T.l_start := off_t (Lock.Start); T.l_len := off_t (Lock.Length); end if; Check (fcntl (int (File), F_SETLK, T'Unchecked_Access)); end Set_Lock; ------------------------ -- Wait_To_Set_Lock -- ------------------------ procedure Wait_To_Set_Lock (File : POSIX.IO.File_Descriptor; Lock : File_Lock; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) is T : aliased struct_flock; Result : int; Old_Mask : aliased Signal_Mask; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); T.l_type := C_Lock_Type (Lock.Lock); if Lock.Whole_File then T.l_whence := SEEK_SET; T.l_start := 0; T.l_len := off_t (POSIX.IO.File_Size (File)); else T.l_whence := C_Whence (Lock.Starting_Point); T.l_start := off_t (Lock.Start); T.l_len := off_t (Lock.Length); end if; Result := fcntl (int (File), F_SETLKW, T'Unchecked_Access); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Wait_To_Set_Lock; end POSIX.File_Locking; florist-gpl-2017-src/libsrc/posix-process_times.adb0000644000076700001450000001163113106553472021764 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P R O C E S S _ T I M E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ package body POSIX.Process_Times is use POSIX.C; ------------------------- -- Elapsed_Real_Time -- ------------------------- function times (buf : tms_ptr) return clock_t; pragma Import (C, times, times_LINKNAME); function Elapsed_Real_Time return Tick_Count is T : Process_Times; begin return Tick_Count (times (T.tms'Unchecked_Access)); end Elapsed_Real_Time; ------------------------- -- Get_Process_Times -- ------------------------- function Get_Process_Times return Process_Times is t : Process_Times; begin t.Elapsed_Real_Time := times (t.tms'Unchecked_Access); return t; end Get_Process_Times; ---------------------------- -- Elapsed_Real_Time_Of -- ---------------------------- function Elapsed_Real_Time_Of (Times : Process_Times) return Tick_Count is begin return Tick_Count (Times.Elapsed_Real_Time); end Elapsed_Real_Time_Of; ----------------------- -- User_CPU_Time_Of -- ----------------------- function User_CPU_Time_Of (Times : Process_Times) return Tick_Count is begin return Tick_Count (Times.tms.tms_utime); end User_CPU_Time_Of; -------------------------- -- System_CPU_Time_Of -- -------------------------- function System_CPU_Time_Of (Times : Process_Times) return Tick_Count is begin return Tick_Count (Times.tms.tms_stime); end System_CPU_Time_Of; ------------------------------------ -- Descendants_User_CPU_Time_Of -- ------------------------------------ function Descendants_User_CPU_Time_Of (Times : Process_Times) return Tick_Count is begin return Tick_Count (Times.tms.tms_cutime); end Descendants_User_CPU_Time_Of; -------------------------------------- -- Descendants_System_CPU_Time_Of -- -------------------------------------- function Descendants_System_CPU_Time_Of (Times : Process_Times) return Tick_Count is begin return Tick_Count (Times.tms.tms_cstime); end Descendants_System_CPU_Time_Of; end POSIX.Process_Times; florist-gpl-2017-src/libsrc/posix_generic_shared_memory.ads0000644000076700001450000000601613106553472023543 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ G E N E R I C _ S H A R E D _ M E M O R Y -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 1991-1994 Florida State University -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ pragma Warnings (Off); with POSIX.Generic_Shared_Memory; pragma Warnings (On); generic package POSIX_Generic_Shared_Memory renames POSIX.Generic_Shared_Memory; florist-gpl-2017-src/libsrc/posix_limits.ads0000644000076700001450000000560013106553472020510 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ L I M I T S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Limits; pragma Elaborate_All (POSIX.Limits); package POSIX_Limits renames POSIX.Limits; florist-gpl-2017-src/libsrc/posix-unsafe_process_primitives.adb0000644000076700001450000002354313106553472024404 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . U N S A F E _ P R O C E S S _ P R I M I T I V E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.Implementation, System, System.Soft_Links, Unchecked_Conversion; package body POSIX.Unsafe_Process_Primitives is use POSIX.C, POSIX.Implementation; function To_Process_ID is new Unchecked_Conversion (pid_t, POSIX.Process_Identification.Process_ID); function To_String_List_Ptr is new Unchecked_Conversion (POSIX_String_List, String_List_Ptr); function To_String_List_Ptr is new Unchecked_Conversion (POSIX.Process_Environment.Environment, String_List_Ptr); ------------------------- -- Local Subprograms -- ------------------------- function Make_Path_Name (Directory : POSIX_String; File : POSIX_String) return POSIX_String; pragma Inline (Make_Path_Name); -- Concatenate a directory name and a file name. function Make_Path_Name (Directory : POSIX_String; File : POSIX_String) return POSIX_String is begin if Directory = "" then return File; end if; if Directory (Directory'Last) = '/' then return Directory & File; end if; return Directory & '/' & File; end Make_Path_Name; ------------ -- Fork -- ------------ function fork return pid_t; pragma Import (C, fork, fork_LINKNAME); function Fork return POSIX.Process_Identification.Process_ID is Result : pid_t; package SSL renames System.Soft_Links; -- save local values of soft-link data NT_Sec_Stack_Addr : constant System.Address := SSL.Get_Sec_Stack_Addr.all; NT_Jmpbuf_Address : constant System.Address := SSL.Get_Jmpbuf_Address.all; begin Result := fork; if Result = -1 then Raise_POSIX_Error; end if; if Result = 0 then -- reset soft links to non-tasking versions of operations SSL.Abort_Defer := SSL.Abort_Defer_NT'Access; SSL.Abort_Undefer := SSL.Abort_Undefer_NT'Access; SSL.Lock_Task := SSL.Task_Lock_NT'Access; SSL.Unlock_Task := SSL.Task_Unlock_NT'Access; SSL.Get_Jmpbuf_Address := SSL.Get_Jmpbuf_Address_NT'Access; SSL.Set_Jmpbuf_Address := SSL.Set_Jmpbuf_Address_NT'Access; SSL.Get_Sec_Stack_Addr := SSL.Get_Sec_Stack_Addr_NT'Access; SSL.Set_Sec_Stack_Addr := SSL.Set_Sec_Stack_Addr_NT'Access; -- reset global data to saved local values for this thread SSL.Set_Sec_Stack_Addr (NT_Sec_Stack_Addr); SSL.Set_Jmpbuf_Address (NT_Jmpbuf_Address); end if; return To_Process_ID (Result); end Fork; ------------ -- Exec -- ------------ function execve (path : char_ptr; argv : char_ptr_ptr; envp : char_ptr_ptr) return int; pragma Import (C, execve, execve_LINKNAME); procedure Exec (Pathname : POSIX.Pathname; Arg_List : POSIX.POSIX_String_List := POSIX.Empty_String_List; Env_List : POSIX.Process_Environment.Environment) is Pathname_With_NUL : POSIX_String := Pathname & NUL; Arg : String_List_Ptr := To_String_List_Ptr (Arg_List); Env : String_List_Ptr := To_String_List_Ptr (Env_List); begin if Arg = null then Arg := Null_String_List_Ptr; end if; if Env = null then Env := Null_String_List_Ptr; end if; Check (execve (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, Arg.Char (1)'Unchecked_Access, Env.Char (1)'Unchecked_Access)); end Exec; ------------ -- Exec -- ------------ function execv (path : char_ptr; argv : char_ptr_ptr) return int; pragma Import (C, execv, execv_LINKNAME); procedure Exec (Pathname : POSIX.Pathname; Arg_List : POSIX.POSIX_String_List := POSIX.Empty_String_List) is Pathname_With_NUL : POSIX_String := Pathname & NUL; Arg : String_List_Ptr := To_String_List_Ptr (Arg_List); begin if Arg = null then Arg := Null_String_List_Ptr; end if; Check (execv (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, Arg.Char (1)'Unchecked_Access)); end Exec; ------------------- -- Exec_Search -- ------------------- procedure Exec_Search (Filename : POSIX.Filename; Arg_List : POSIX.POSIX_String_List := POSIX.Empty_String_List; Env_List : POSIX.Process_Environment.Environment) is Filename_With_NUL : POSIX_String := Filename & NUL; Arg : String_List_Ptr := To_String_List_Ptr (Arg_List); Env : String_List_Ptr := To_String_List_Ptr (Env_List); begin -- .... Change POSIX.5? -- There is no POSIX.1 function that takes an environment list -- and searches for a filename, apparently, so we have to simulate -- the effect here. if Arg = null then Arg := Null_String_List_Ptr; end if; if Env = null then Env := Null_String_List_Ptr; end if; for I in Filename'Range loop if Filename (I) = '/' then Check (execve (Filename_With_NUL (Filename_With_NUL'First)'Unchecked_Access, Arg.Char (1)'Unchecked_Access, Env.Char (1)'Unchecked_Access)); return; end if; end loop; -- filename does not contain "/" declare Path : constant POSIX_String := POSIX.Process_Environment.Environment_Value_Of ("PATH", "/bin:/usr/bin"); Start : Positive; P : Positive; Err : Error_Code := No_Such_File_Or_Directory; begin P := Path'First; loop Start := P; while P <= Path'Last and then Path (P) /= ':' loop P := P + 1; end loop; declare Pathname : constant POSIX_String := Make_Path_Name (Path (Start .. P - 1), Filename); begin Exec (Pathname, Arg_List, Env_List); exception when POSIX_Error => null; end; if Get_Error_Code /= No_Such_File_Or_Directory then Err := Get_Error_Code; end if; exit when P > Path'Last; P := P + 1; -- skip colon end loop; Raise_POSIX_Error (Err); end; end Exec_Search; ------------------- -- Exec_Search -- ------------------- function execvp (file : char_ptr; argv : char_ptr_ptr) return int; pragma Import (C, execvp, execvp_LINKNAME); procedure Exec_Search (Filename : POSIX.Filename; Arg_List : POSIX.POSIX_String_List := POSIX.Empty_String_List) is Filename_With_NUL : POSIX_String := Filename & NUL; Arg : String_List_Ptr := To_String_List_Ptr (Arg_List); begin if Arg = null then Arg := Null_String_List_Ptr; end if; Check (execvp (Filename_With_NUL (Filename_With_NUL'First)'Unchecked_Access, Arg.Char (1)'Unchecked_Access)); end Exec_Search; end POSIX.Unsafe_Process_Primitives; florist-gpl-2017-src/libsrc/posix_user_database.ads0000644000076700001450000000563413106553472022020 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ U S E R _ D A T A B A S E -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.User_Database; pragma Elaborate_All (POSIX.User_Database); package POSIX_User_Database renames POSIX.User_Database; florist-gpl-2017-src/libsrc/system_storage_elements.ads0000644000076700001450000000615113106553472022733 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- S Y S T E M _ S T O R A G E _ E L E M E N T S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996, 1997 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- Copyright (C) 2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with System.Storage_Elements; package System_Storage_Elements renames System.Storage_Elements; florist-gpl-2017-src/libsrc/posix-memory_mapping.adb0000644000076700001450000001464113106553472022134 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . M E M O R Y _ M A P P I N G -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation, Unchecked_Conversion; package body POSIX.Memory_Mapping is use POSIX.Implementation; use System; function To_Address is new Unchecked_Conversion (ptr_as_int, System.Address); Zero_Address : constant System.Address := To_Address (0); Failure : constant System.Address := To_Address (MAP_FAILED); ------------------ -- Map_Memory -- ------------------ function mmap (addr : System.Address; len : size_t; prot : int; flags : int; fildes : int; off : off_t) return System.Address; pragma Import (C, mmap, mmap_LINKNAME); function Map_Memory (First : System.Address; Length : System.Storage_Elements.Storage_Offset; Protection : Protection_Options; Mapping : Mapping_Options; Location : Location_Options; File : POSIX.IO.File_Descriptor; Offset : POSIX.IO_Count) return System.Address is Result : System.Address; begin Result := mmap (First, size_t (Length), int (Option_Set (Protection).Option), int (Option_Set (Mapping).Option or Option_Set (Location).Option or MAP_FILE), int (File), off_t (Offset)); if Result = Failure then Raise_POSIX_Error; end if; return Result; end Map_Memory; ------------------ -- Map_Memory -- ------------------ function Map_Memory (Length : System.Storage_Elements.Storage_Offset; Protection : Protection_Options; Mapping : Mapping_Options; File : POSIX.IO.File_Descriptor; Offset : POSIX.IO_Count) return System.Address is Result : System.Address; begin Result := mmap (Zero_Address, size_t (Length), int (Option_Set (Protection).Option), int (Option_Set (Mapping).Option or MAP_FILE), int (File), off_t (Offset)); if Result = Failure then Raise_POSIX_Error; end if; return Result; end Map_Memory; -------------------- -- Unmap_Memory -- -------------------- procedure Unmap_Memory (First : System.Address; Length : System.Storage_Elements.Storage_Offset) is function munmap (addr : System.Address; len : size_t) return int; pragma Import (C, munmap, munmap_LINKNAME); begin Check (munmap (First, size_t (Length))); end Unmap_Memory; ------------------------- -- Change_Protection -- ------------------------- procedure Change_Protection (First : System.Address; Length : System.Storage_Elements.Storage_Offset; Protection : Protection_Options) is function mprotect (addr : System.Address; len : size_t; prot : int) return int; pragma Import (C, mprotect, mprotect_LINKNAME); begin Check (mprotect (First, size_t (Length), int (Option_Set (Protection).Option))); end Change_Protection; -------------------------- -- Synchronize_Memory -- -------------------------- procedure Synchronize_Memory (First : System.Address; Length : System.Storage_Elements.Storage_Offset; Options : Synchronize_Memory_Options := Wait_For_Completion) is function msync (address : System.Address; len : size_t; flags : int) return int; pragma Import (C, msync, msync_LINKNAME); begin Check (msync (First, size_t (Length), int (Option_Set (Options).Option))); end Synchronize_Memory; end POSIX.Memory_Mapping; florist-gpl-2017-src/libsrc/posix_files.ads0000644000076700001450000000571313106553472020316 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ F I L E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 1991-1994 Florida State University -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Files; pragma Elaborate_All (POSIX.Files); package POSIX_Files renames POSIX.Files; florist-gpl-2017-src/libsrc/posix_terminal_functions.ads0000644000076700001450000000566013106553472023120 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ T E R M I N A L _ F U N C T I O N S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Terminal_Functions; pragma Elaborate_All (POSIX.Terminal_Functions); package POSIX_Terminal_Functions renames POSIX.Terminal_Functions; florist-gpl-2017-src/libsrc/posix-io.ads0000644000076700001450000002547113106553472017544 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . I O -- -- -- -- S p e c -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2010, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with Ada.Streams, POSIX, POSIX.C, POSIX.Permissions, POSIX.Process_Identification, System; pragma Elaborate_All (POSIX); package POSIX.IO is type File_Descriptor is range 0 .. POSIX.Open_Files_Maxima'Last - 1; for File_Descriptor'Size use POSIX.C.int'Size; Standard_Input : constant File_Descriptor := 0; Standard_Output : constant File_Descriptor := 1; Standard_Error : constant File_Descriptor := 2; type IO_Offset is new POSIX.C.off_t; -- File Modes and Options type File_Mode is (Read_Only, Write_Only, Read_Write); type Open_Option_Set is new POSIX.Option_Set; -- Empty_Set, "+" and unary and binary "-" are derived operations Non_Blocking : constant Open_Option_Set; Append : constant Open_Option_Set; Truncate : constant Open_Option_Set; Exclusive : constant Open_Option_Set; Not_Controlling_Terminal : constant Open_Option_Set; File_Synchronized : constant Open_Option_Set; Data_Synchronized : constant Open_Option_Set; Read_Synchronized : constant Open_Option_Set; -- Operations to open or close file descriptors function Open (Name : POSIX.Pathname; Mode : File_Mode; Options : Open_Option_Set := Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return File_Descriptor; function Open_Or_Create (Name : POSIX.Pathname; Mode : File_Mode; Permissions : POSIX.Permissions.Permission_Set; Options : Open_Option_Set := Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return File_Descriptor; function Is_Open (File : File_Descriptor) return Boolean; procedure Close (File : File_Descriptor; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); function Duplicate (File : File_Descriptor; Target : File_Descriptor := 0) return File_Descriptor; function Duplicate_and_Close (File : File_Descriptor; Target : File_Descriptor := 0; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return File_Descriptor; procedure Create_Pipe (Read_End : out File_Descriptor; Write_End : out File_Descriptor); -- File Input/Output operations subtype IO_Buffer is POSIX.POSIX_String; procedure Read (File : File_Descriptor; Buffer : out IO_Buffer; Last : out POSIX.IO_Count; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure NONSTANDARD_Read (File : File_Descriptor; Buffer : out IO_Buffer; Last : out Natural; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Read (File : File_Descriptor; Buffer : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Write (File : File_Descriptor; Buffer : IO_Buffer; Last : out POSIX.IO_Count; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure NONSTANDARD_Write (File : File_Descriptor; Buffer : IO_Buffer; Last : out Natural; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Write (File : File_Descriptor; Buffer : Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); generic type T is private; procedure Generic_Read (File : File_Descriptor; Item : out T; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); generic type T is private; procedure Generic_Write (File : File_Descriptor; Item : T; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals); -- File position operations type Position is (From_Beginning, From_Current_Position, From_End_Of_File); procedure Seek (File : File_Descriptor; Offset : IO_Offset; Result : out IO_Offset; Starting_Point : Position := From_Beginning); function File_Size (File : File_Descriptor) return POSIX.IO_Count; function File_Position (File : File_Descriptor) return IO_Offset; -- Terminal operations function Is_A_Terminal (File : File_Descriptor) return Boolean; function Get_Terminal_Name (File : File_Descriptor) return POSIX.Pathname; -- File Control operations procedure Get_File_Control (File : File_Descriptor; Mode : out File_Mode; Options : out Open_Option_Set); procedure Set_File_Control (File : File_Descriptor; Options : Open_Option_Set); function Get_Close_On_Exec (File : File_Descriptor) return Boolean; procedure Set_Close_On_Exec (File : File_Descriptor; To : Boolean := True); procedure Change_Permissions (File : POSIX.IO.File_Descriptor; Permission : POSIX.Permissions.Permission_Set); procedure Truncate_File (File : POSIX.IO.File_Descriptor; Length : POSIX.IO_Count); procedure Synchronize_File (File : POSIX.IO.File_Descriptor); procedure Synchronize_Data (File : POSIX.IO.File_Descriptor); -- POSIX.5c/D4 additions -- 6.1.1 Sockets Option Flags from P1003.5c Signal_When_Socket_Ready : constant Open_Option_Set; -- 6.1.12 Sockets File Ownership procedures from P1003.5c procedure Get_Owner (File : File_Descriptor; Process : out POSIX.Process_Identification.Process_ID; Group : out POSIX.Process_Identification.Process_Group_ID); procedure Set_Socket_Process_Owner (File : File_Descriptor; Process : POSIX.Process_Identification.Process_ID); procedure Set_Socket_Group_Owner (File : File_Descriptor; Group : POSIX.Process_Identification.Process_Group_ID); type IO_Vector is limited private; procedure Set_Buffer (Vector : in out IO_Vector; Buffer : System.Address; Length : Positive); procedure Get_Buffer (Vector : IO_Vector; Buffer : out System.Address; Length : out POSIX.IO_Count); private Non_Blocking : constant Open_Option_Set := Open_Option_Set (Option_Set'(Option => POSIX.C.O_NONBLOCK)); Append : constant Open_Option_Set := Open_Option_Set (Option_Set'(Option => POSIX.C.O_APPEND)); -- .... Change POSIX.5? -- This Append hides operation on String_Lists, and vice versa, -- if we "use" both this package and POSIX. Truncate : constant Open_Option_Set := Open_Option_Set (Option_Set'(Option => POSIX.C.O_TRUNC)); Exclusive : constant Open_Option_Set := Open_Option_Set (Option_Set'(Option => POSIX.C.O_EXCL)); Not_Controlling_Terminal : constant Open_Option_Set := Open_Option_Set (Option_Set'(Option => POSIX.C.O_NOCTTY)); File_Synchronized : constant Open_Option_Set := Open_Option_Set (Option_Set'(Option => POSIX.C.O_SYNC)); Data_Synchronized : constant Open_Option_Set := Open_Option_Set (Option_Set'(Option => POSIX.C.O_DSYNC)); Read_Synchronized : constant Open_Option_Set := Open_Option_Set (Option_Set'(Option => POSIX.C.O_RSYNC)); -- P1003.5c/D4 additions Signal_When_Socket_Ready : constant Open_Option_Set := Open_Option_Set (POSIX.Empty_Set); type IO_Vector is record C : aliased POSIX.C.Sockets.struct_iovec := POSIX.C.Sockets.struct_iovec'(iov_base => null, iov_len => 0); end record; end POSIX.IO; florist-gpl-2017-src/libsrc/posix-memory_mapping.ads0000644000076700001450000001405313106553472022152 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . M E M O R Y _ M A P P I N G -- -- -- -- S p e c -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2010, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX, POSIX.C, POSIX.IO, System, System.Storage_Elements; pragma Elaborate_All (POSIX); package POSIX.Memory_Mapping is use POSIX.C; type Protection_Options is new POSIX.Option_Set; Allow_Read : constant Protection_Options; Allow_Write : constant Protection_Options; Allow_Execute : constant Protection_Options; type Mapping_Options is new POSIX.Option_Set; Map_Shared : constant Mapping_Options; Map_Private : constant Mapping_Options; type Location_Options is new POSIX.Option_Set; Exact_Address : constant Location_Options; Nearby_Address : constant Location_Options; function Map_Memory (First : System.Address; Length : System.Storage_Elements.Storage_Offset; Protection : Protection_Options; Mapping : Mapping_Options; Location : Location_Options; File : POSIX.IO.File_Descriptor; Offset : POSIX.IO_Count) return System.Address; function Map_Memory (Length : System.Storage_Elements.Storage_Offset; Protection : Protection_Options; Mapping : Mapping_Options; File : POSIX.IO.File_Descriptor; Offset : POSIX.IO_Count) return System.Address; procedure Unmap_Memory (First : System.Address; Length : System.Storage_Elements.Storage_Offset); procedure Change_Protection (First : System.Address; Length : System.Storage_Elements.Storage_Offset; Protection : Protection_Options); type Synchronize_Memory_Options is new POSIX.Option_Set; Wait_For_Completion : constant Synchronize_Memory_Options; No_Wait_For_Completion : constant Synchronize_Memory_Options; Invalidate_Cached_Data : constant Synchronize_Memory_Options; procedure Synchronize_Memory (First : System.Address; Length : System.Storage_Elements.Storage_Offset; Options : Synchronize_Memory_Options := Wait_For_Completion); private Allow_Read : constant Protection_Options := Protection_Options (Option_Set'(Option => POSIX.C.PROT_READ)); Allow_Write : constant Protection_Options := Protection_Options (Option_Set'(Option => POSIX.C.PROT_WRITE)); Allow_Execute : constant Protection_Options := Protection_Options (Option_Set'(Option => POSIX.C.PROT_EXEC)); Map_Shared : constant Mapping_Options := Mapping_Options (Option_Set'(Option => POSIX.C.MAP_SHARED)); Map_Private : constant Mapping_Options := Mapping_Options (Option_Set'(Option => POSIX.C.MAP_PRIVATE)); Exact_Address : constant Location_Options := Location_Options (Option_Set'(Option => POSIX.C.MAP_FIXED)); Nearby_Address : constant Location_Options := Empty_Set; Wait_For_Completion : constant Synchronize_Memory_Options := Synchronize_Memory_Options (Option_Set'(Option => POSIX.C.MS_SYNC)); No_Wait_For_Completion : constant Synchronize_Memory_Options := Synchronize_Memory_Options (Option_Set'(Option => POSIX.C.MS_ASYNC)); Invalidate_Cached_Data : constant Synchronize_Memory_Options := Synchronize_Memory_Options (Option_Set'(Option => POSIX.C.MS_INVALIDATE)); end POSIX.Memory_Mapping; florist-gpl-2017-src/libsrc/posix-memory_range_locking.adb0000644000076700001450000001213313106553472023275 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . M E M O R Y _ R A N G E _ L O C K I N G -- -- -- -- B o d y -- -- -- -- -- -- Copyright (c) 1996-1998 Florida State University (FSU) -- -- All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.Implementation; package body POSIX.Memory_Range_Locking is use POSIX.C, POSIX.Implementation; ------------------ -- Lock_Range -- ------------------ procedure Lock_Range (First : System.Address; Length : System.Storage_Elements.Storage_Offset) is function mlock (addr : access System.Address; len : size_t) return int; pragma Import (C, mlock, mlock_LINKNAME); Addr : aliased System.Address := First; begin -- .... Some OS (eg. Solaris) has non-standard mlock/munlock. -- For the reason if "mlock/munlock" fails with EINVAL, -- we speculate that the OS has non-standard form of the -- functions. So, try it again with a different form of the function. -- .... This is not a perfact solution and we feel that this kind of -- thing has to be resolved in the configuration management. It does its -- work for now.... if mlock (Addr'Unchecked_Access, size_t (Length)) = -1 and then Fetch_Errno = Invalid_Argument then declare function mlock (addr : System.Address; len : size_t) return int; pragma Import (C, mlock, mlock_LINKNAME); begin Check (mlock (Addr, size_t (Length))); end; else Check (mlock (Addr'Unchecked_Access, size_t (Length))); end if; end Lock_Range; -------------------- -- UnLock_Range -- -------------------- procedure Unlock_Range (First : System.Address; Length : System.Storage_Elements.Storage_Offset) is function munlock (addr : access System.Address; len : size_t) return int; pragma Import (C, munlock, munlock_LINKNAME); Addr : aliased System.Address := First; begin if munlock (Addr'Unchecked_Access, size_t (Length)) = -1 and then Fetch_Errno = Invalid_Argument then declare function munlock (addr : System.Address; len : size_t) return int; pragma Import (C, munlock, munlock_LINKNAME); begin Check (munlock (Addr, size_t (Length))); end; else Check (munlock (Addr'Unchecked_Access, size_t (Length))); end if; end Unlock_Range; end POSIX.Memory_Range_Locking; florist-gpl-2017-src/libsrc/posix-permissions-implementation.ads0000644000076700001450000000724113106553472024526 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P E R M I S S I O N S . I M P L E M E N T A T I O N -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996, 1997 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.C; use POSIX.C; package POSIX.Permissions.Implementation is -- ========= -- -- WARNING -- -- ========= -- -- This package should NOT be used directly by an application. -- It is internal to the FLORIST implementation of the POSIX.5 API, -- and may be changed or replaced in future versions of FLORIST. Permission_Bits : constant POSIX.C.mode_t := POSIX.C.S_IRWXU or POSIX.C.S_IRWXG or POSIX.C.S_IRWXO or POSIX.C.S_ISUID or POSIX.C.S_ISGID; File_Access_Permission_Bits : constant POSIX.C.mode_t := POSIX.C.S_IRWXU or POSIX.C.S_IRWXG or POSIX.C.S_IRWXO; function Form_Ada_Permission (perm : POSIX.C.mode_t) return Permission_Set; function Form_C_Permission (perm : Permission_Set) return POSIX.C.mode_t; end POSIX.Permissions.Implementation; florist-gpl-2017-src/libsrc/posix-process_scheduling.ads0000644000076700001450000001163513106553472023015 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P R O C E S S _ S C H E D U L I N G -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX_Process_Identification; package POSIX.Process_Scheduling is subtype Scheduling_Priority is Integer; type Scheduling_Parameters is private; function Get_Priority (Parameters : Scheduling_Parameters) return Scheduling_Priority; procedure Set_Priority (Parameters : in out Scheduling_Parameters; Priority : Scheduling_Priority); type Scheduling_Policy is new Integer; -- One might consider auto-configuring -- the upper and lower bounds of this range to more tightly fit -- the range of values supported by the underlying OS. -- However, that would not help much. For example, LynxOS is -- reputed to have the following values: -- Sched_Fifo : constant := 2097152; -- Sched_Other : constant := 4194304; -- Sched_Rr : constant := 1048576; -- Also, we should not limit it to the just three values shown below, -- because we might want to use these interfaces with implementation -- defined policies. Sched_FIFO : constant Scheduling_Policy := POSIX.C.SCHED_FIFO; Sched_RR : constant Scheduling_Policy := POSIX.C.SCHED_RR; Sched_Other : constant Scheduling_Policy := POSIX.C.SCHED_OTHER; procedure Set_Scheduling_Parameters (Process : POSIX_Process_Identification.Process_ID; Parameters : Scheduling_Parameters); function Get_Scheduling_Parameters (Process : POSIX_Process_Identification.Process_ID) return Scheduling_Parameters; procedure Set_Scheduling_Policy (Process : POSIX_Process_Identification.Process_ID; New_Policy : Scheduling_Policy; Parameters : Scheduling_Parameters); function Get_Scheduling_Policy (Process : POSIX_Process_Identification.Process_ID) return Scheduling_Policy; procedure Yield; function Get_Maximum_Priority (Policy : Scheduling_Policy) return Scheduling_Priority; function Get_Minimum_Priority (Policy : Scheduling_Policy) return Scheduling_Priority; function Get_Round_Robin_Interval (Process : POSIX_Process_Identification.Process_ID) return POSIX.Timespec; private type Scheduling_Parameters is record Param : aliased POSIX.C.struct_sched_param; end record; end POSIX.Process_Scheduling; florist-gpl-2017-src/libsrc/posix-file_status-extensions.ads0000644000076700001450000000636113106553472023651 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . F I L E _ S T A T U S . E X T E N S I O N S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ -- This file contains system-dependent (and therefore non-portable) -- extensions to POSIX.File_Status. package POSIX.File_Status.Extensions is function IO_Block_Size_Of (File_Status : Status) return POSIX.IO_Count; -- File system-specific preferred I/O block size for this object function Allocated_Blocks_Of (File_Status : Status) return POSIX.IO_Count; -- Number of blocks allocated for this object end POSIX.File_Status.Extensions; florist-gpl-2017-src/libsrc/posix_permissions.ads0000644000076700001450000000562413106553472021570 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ P E R M I S S I O N S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Permissions; pragma Elaborate_All (POSIX.Permissions); package POSIX_Permissions renames POSIX.Permissions; florist-gpl-2017-src/libsrc/posix-permissions.ads0000644000076700001450000001044313106553472021501 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . P E R M I S S I O N S -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX; package POSIX.Permissions is type Permission is (Others_Execute, Others_Write, Others_Read, Group_Execute, Group_Write, Group_Read, Owner_Execute, Owner_Write, Owner_Read, Set_Group_ID, Set_User_ID); type Permission_Set is array (Permission) of Boolean; Owner_Permission_Set : constant Permission_Set := Permission_Set' (Owner_Read | Owner_Write | Owner_Execute => True, others => False); Group_Permission_Set : constant Permission_Set := Permission_Set' (Group_Read | Group_Write | Group_Execute => True, others => False); Others_Permission_Set : constant Permission_Set := Permission_Set' (Others_Read | Others_Write | Others_Execute => True, others => False); Access_Permission_Set : constant Permission_Set := Permission_Set' (Owner_Read | Owner_Write | Owner_Execute => True, Group_Read | Group_Write | Group_Execute => True, Others_Read | Others_Write | Others_Execute => True, others => False); Set_Group_ID_Set : constant Permission_Set := Permission_Set' (Set_Group_ID => True, others => False); Set_User_ID_Set : constant Permission_Set := Permission_Set' (Set_User_ID => True, others => False); -- POSIX Permission-oriented operations function Get_Allowed_Process_Permissions return Permission_Set; procedure Set_Allowed_Process_Permissions (Permissions : Permission_Set); procedure Set_Allowed_Process_Permissions (Permissions : Permission_Set; Old_Perms : out Permission_Set); end POSIX.Permissions; florist-gpl-2017-src/libsrc/posix-semaphores.adb0000644000076700001450000002373313106553472021261 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . S E M A P H O R E S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2010, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation, POSIX.Permissions.Implementation, Unchecked_Conversion; package body POSIX.Semaphores is use POSIX.C, POSIX.Implementation, POSIX.Permissions.Implementation; function To_int is new Unchecked_Conversion (Bits, int); function To_int is new Unchecked_Conversion (Semaphore_Descriptor, ptr_as_int); procedure Check_And_Restore_Signals (Result : Semaphore_Descriptor; Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access); pragma Inline (Check_And_Restore_Signals); procedure Check_And_Restore_Signals (Result : Semaphore_Descriptor; Masked_Signals : Signal_Masking; Old_Mask : Signal_Mask_Access) is begin if To_int (Result) = -1 then Restore_Signals_And_Raise_POSIX_Error (Masked_Signals, Old_Mask); else Restore_Signals (Masked_Signals, Old_Mask); end if; end Check_And_Restore_Signals; procedure Validate (Sem : Semaphore_Descriptor); pragma Inline (Validate); procedure Validate (Sem : Semaphore_Descriptor) is begin if Sem = null then Raise_POSIX_Error (Invalid_Argument); end if; end Validate; --------------------------------- -- Initialize -- --------------------------------- function sem_init (s : Semaphore_Descriptor; pshared : int; value : unsigned) return int; pragma Import (C, sem_init, sem_init_LINKNAME); procedure Initialize (Sem : in out Semaphore; Value : Natural; Is_Shared : Boolean := False) is begin Check (sem_init (Sem.Sem'Unchecked_Access, Boolean'Pos (Is_Shared), unsigned (Value))); end Initialize; --------------------------------- -- Descriptor_Of -- --------------------------------- function Descriptor_Of (Sem : Semaphore) return Semaphore_Descriptor is begin return Sem.Sem'Unchecked_Access; end Descriptor_Of; --------------------------------- -- Finalize -- --------------------------------- function sem_destroy (sem : Semaphore_Descriptor) return int; pragma Import (C, sem_destroy, sem_destroy_LINKNAME); procedure Finalize (Sem : in out Semaphore) is begin Check (sem_destroy (Sem.Sem'Unchecked_Access)); end Finalize; --------------------------------- -- Open -- --------------------------------- function sem_open (name : char_ptr; oflag : int; mode : mode_t; value : unsigned) return Semaphore_Descriptor; function sem_open (name : char_ptr; oflag : int) return Semaphore_Descriptor; pragma Import (C, sem_open, sem_open_LINKNAME); function Open (Name : POSIX.POSIX_String; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return Semaphore_Descriptor is Result : Semaphore_Descriptor; Name_With_NUL : POSIX_String := Name & NUL; Old_Mask : aliased Signal_Mask; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := sem_open (Name_With_NUL (Name_With_NUL'First)'Unchecked_Access, 0); Check_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); return Result; end Open; --------------------------------- -- Open_Or_Create -- --------------------------------- function Open_Or_Create (Name : POSIX.POSIX_String; Permissions : POSIX.Permissions.Permission_Set; Value : Natural; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return Semaphore_Descriptor is Result : Semaphore_Descriptor; Name_With_NUL : POSIX_String := Name & NUL; Old_Mask : aliased Signal_Mask; begin Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := sem_open (Name_With_NUL (Name_With_NUL'First)'Unchecked_Access, To_int (Option_Set (Options).Option or O_CREAT), Form_C_Permission (Permissions), unsigned (Value)); Check_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); return Result; end Open_Or_Create; --------------------------------- -- Close -- --------------------------------- function sem_close (sem : Semaphore_Descriptor) return int; pragma Import (C, sem_close, sem_close_LINKNAME); procedure Close (Sem : in out Semaphore_Descriptor) is begin Check (sem_close (Sem)); end Close; --------------------------------- -- Unlink_Semaphore -- --------------------------------- function sem_unlink (name : char_ptr) return int; pragma Import (C, sem_unlink, sem_unlink_LINKNAME); procedure Unlink_Semaphore (Name : POSIX.POSIX_String) is Name_With_NUL : POSIX_String := Name & NUL; begin Check (sem_unlink (Name_With_NUL (Name_With_NUL'First)'Unchecked_Access)); end Unlink_Semaphore; --------------------------------- -- Wait -- --------------------------------- function sem_wait (sem : Semaphore_Descriptor) return int; pragma Import (C, sem_wait, sem_wait_LINKNAME); procedure Wait (Sem : Semaphore_Descriptor; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) is Result : int; Old_Mask : aliased Signal_Mask; begin Validate (Sem); Mask_Signals (Masked_Signals, Old_Mask'Unchecked_Access); Result := sem_wait (Sem); Check_NNeg_And_Restore_Signals (Result, Masked_Signals, Old_Mask'Unchecked_Access); end Wait; --------------------------------- -- Try_Wait -- --------------------------------- function sem_trywait (sem : Semaphore_Descriptor) return int; pragma Import (C, sem_trywait, sem_trywait_LINKNAME); function Try_Wait (Sem : Semaphore_Descriptor) return Boolean is Result : int; begin Validate (Sem); Result := sem_trywait (Sem); if Result = 0 then return True; elsif Fetch_Errno = EAGAIN then return False; else Raise_POSIX_Error; -- return statement to suppress compiler warning message return False; end if; end Try_Wait; --------------------------------- -- Post -- --------------------------------- function sem_post (sem : Semaphore_Descriptor) return int; pragma Import (C, sem_post, sem_post_LINKNAME); procedure Post (Sem : Semaphore_Descriptor) is begin Validate (Sem); Check (sem_post (Sem)); end Post; --------------------------------- -- Get_Value -- --------------------------------- function sem_getvalue (sem : Semaphore_Descriptor; sval : access int) return int; pragma Import (C, sem_getvalue, sem_getvalue_LINKNAME); function Get_Value (Sem : Semaphore_Descriptor) return Integer is Value : aliased int; begin Validate (Sem); Check (sem_getvalue (Sem, Value'Unchecked_Access)); return Integer (Value); end Get_Value; end POSIX.Semaphores; florist-gpl-2017-src/libsrc/ada_streams.ads0000644000076700001450000000610513106553472020251 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- A D A _ S T R E A M S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996, 1997 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- Copyright (C) 2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with Ada.Streams; package Ada_Streams renames Ada.Streams; florist-gpl-2017-src/libsrc/posix_error_codes.ads0000644000076700001450000000562413106553472021523 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ E R R O R _ C O D E S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Error_Codes; pragma Elaborate_All (POSIX.Error_Codes); package POSIX_Error_Codes renames POSIX.Error_Codes; florist-gpl-2017-src/libsrc/posix-file_status.ads0000644000076700001450000001211613106553472021447 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . F I L E _ S T A T U S -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX.C, POSIX.Calendar, POSIX.IO, POSIX.Permissions, POSIX.Process_Identification; package POSIX.File_Status is type Status is private; function Get_File_Status (Pathname : POSIX.Pathname) return Status; function Get_File_Status (File : POSIX.IO.File_Descriptor) return Status; -- Get_Link_Status is not in the IEEE standard function Get_Link_Status (Pathname : POSIX.Pathname) return Status; type File_ID is private; type Device_ID is private; subtype Links is Natural range 0 .. POSIX.Link_Limit_Maxima'Last; function Permission_Set_Of (File_Status : Status) return POSIX.Permissions.Permission_Set; function File_ID_Of (File_Status : Status) return File_ID; function Device_ID_Of (File_Status : Status) return Device_ID; function Link_Count_Of (File_Status : Status) return Links; function Owner_Of (File_Status : Status) return POSIX.Process_Identification.User_ID; function Group_Of (File_Status : Status) return POSIX.Process_Identification.Group_ID; function Size_Of (File_Status : Status) return POSIX.IO_Count; function Last_Access_Time_Of (File_Status : Status) return POSIX.Calendar.POSIX_Time; function Last_Modification_Time_Of (File_Status : Status) return POSIX.Calendar.POSIX_Time; function Last_Status_Change_Time_Of (File_Status : Status) return POSIX.Calendar.POSIX_Time; function Is_Block_Special_File (File_Status : Status) return Boolean; function Is_Character_Special_File (File_Status : Status) return Boolean; function Is_Directory (File_Status : Status) return Boolean; function Is_FIFO (File_Status : Status) return Boolean; -- Is_Symbolic_Link is not in the IEEE standard function Is_Symbolic_Link (File_Status : Status) return Boolean; function Is_Regular_File (File_Status : Status) return Boolean; -- Is_Socket is part of the POSIX.5c [D2] function Is_Socket (File_Status : Status) return Boolean; function Is_Shared_Memory (File_Status : Status) return Boolean; function Is_Message_Queue (File_Status : Status) return Boolean; function Is_Semaphore (File_Status : Status) return Boolean; private type Status is new POSIX.C.struct_stat; type File_ID is new POSIX.C.ino_t; type Device_ID is new POSIX.C.dev_t; end POSIX.File_Status; florist-gpl-2017-src/libsrc/posix_memory_mapping.ads0000644000076700001450000000564013106553472022236 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ M E M O R Y _ M A P P I N G -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Memory_Mapping; pragma Elaborate_All (POSIX.Memory_Mapping); package POSIX_Memory_Mapping renames POSIX.Memory_Mapping; florist-gpl-2017-src/libsrc/posix_file_status.ads0000644000076700001450000000574313106553472021541 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ F I L E _ S T A T U S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 1991-1994 Florida State University -- -- Copyright (C) 1995-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.File_Status; pragma Elaborate_All (POSIX.File_Status); package POSIX_File_Status renames POSIX.File_Status; florist-gpl-2017-src/libsrc/posix-user_database.ads0000644000076700001450000001017013106553472021725 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . U S E R _ D A T A B A S E -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX, POSIX.C, POSIX_Process_Identification; package POSIX.User_Database is type User_Database_Item is private; -- operations to get information From a User_Database_Entry function User_Name_Of (DB_Item : User_Database_Item) return POSIX.POSIX_String; pragma Inline (User_Name_Of); function User_ID_Of (DB_Item : User_Database_Item) return POSIX_Process_Identification.User_ID; pragma Inline (User_ID_Of); function Group_ID_Of (DB_Item : User_Database_Item) return POSIX_Process_Identification.Group_ID; pragma Inline (Group_ID_Of); function Initial_Directory_Of (DB_Item : User_Database_Item) return POSIX.POSIX_String; pragma Inline (Initial_Directory_Of); function Initial_Program_Of (DB_Item : User_Database_Item) return POSIX.POSIX_String; pragma Inline (Initial_Program_Of); -- operations to Get User_Database_Item function Get_User_Database_Item (UID : POSIX_Process_Identification.User_ID) return User_Database_Item; function Get_User_Database_Item (Name : POSIX.POSIX_String) return User_Database_Item; private type User_Database_Item is new POSIX.C.passwd_ptr; -- .... Change POSIX.5? -- This direct mapping to the C interface means these operations -- are not tasking-safe. However, we see no reasonable alternative. -- See comments in POSIX.Group_Database for more detail. end POSIX.User_Database; florist-gpl-2017-src/libsrc/posix-supplement_to_ada_io.ads0000644000076700001450000001173013106553472023320 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . S U P P L E M E N T _ T O _ A D A _ I O -- -- -- -- S p e c -- -- -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with Ada.IO_Exceptions, Ada.Text_IO, POSIX.IO, POSIX.Permissions; package POSIX.Supplement_to_Ada_IO is type File_Structure_Values is (Regular, FIFO); type Terminal_Input_Values is (Lines, Characters); type Possible_File_Descriptor (Valid : Boolean := False) is record case Valid is when True => Descriptor : POSIX.IO.File_Descriptor; when False => null; end case; end record; type Form_Values_for_Open is record Append : Boolean := False; Blocking : POSIX.Text_IO_Blocking_Behavior := POSIX.IO_Blocking_Behavior; Terminal_Input : Terminal_Input_Values := Lines; Page_Terminators : Boolean := True; File_Descriptor : Possible_File_Descriptor; end record; type Form_Values_for_Create is record Permission_Mask : POSIX.Permissions.Permission_Set := POSIX.Permissions.Access_Permission_Set; Blocking : POSIX.Text_IO_Blocking_Behavior := POSIX.IO_Blocking_Behavior; Terminal_Input : Terminal_Input_Values := Lines; File_Structure : File_Structure_Values := Regular; Page_Terminators : Boolean := True; end record; function Form_String (Val : Form_Values_for_Open) return String; function Form_Value (Str : String) return Form_Values_for_Open; function Form_String (Val : Form_Values_for_Create) return String; function Form_Value (Str : String) return Form_Values_for_Create; procedure Flush_All; procedure Flush_Text_IO (File : Ada.Text_IO.File_Type); generic type File_Type is limited private; procedure Flush_Sequential_IO (File : File_Type); generic type File_Type is limited private; procedure Flush_Direct_IO (File : File_Type); -- .... Change POSIX.5? -- This is a terrible interface! -- These generic procedures can only be implemented by trickery, -- since we have no way of getting a handle for the corresponding -- instantiation, or the set of files that may be open using those -- the particular instantiation. Use_Error : exception renames Ada.IO_Exceptions.Use_Error; end POSIX.Supplement_to_Ada_IO; florist-gpl-2017-src/libsrc/posix_process_scheduling.ads0000644000076700001450000000566013106553472023100 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X _ P R O C E S S _ S C H E D U L I N G -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996 Florida State University (FSU), All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Process_Scheduling; pragma Elaborate_All (POSIX.Process_Scheduling); package POSIX_Process_Scheduling renames POSIX.Process_Scheduling; florist-gpl-2017-src/libsrc/posix-shared_memory_objects.ads0000644000076700001450000000725613106553472023505 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . S H A R E D _ M E M O R Y _ O B J E C T S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2010, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of the POSIX -- -- Ada bindings for use with the GNAT Ada compiler and the FSU Gnu Ada -- -- Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with POSIX.IO, POSIX.Permissions; package POSIX.Shared_Memory_Objects is function Open_Shared_Memory (Name : POSIX.POSIX_String; Mode : POSIX.IO.File_Mode; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return POSIX.IO.File_Descriptor; function Open_Or_Create_Shared_Memory (Name : POSIX.POSIX_String; Mode : POSIX.IO.File_Mode; Permissions : POSIX.Permissions.Permission_Set; Options : POSIX.IO.Open_Option_Set := POSIX.IO.Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return POSIX.IO.File_Descriptor; procedure Unlink_Shared_Memory (Name : POSIX.POSIX_String); end POSIX.Shared_Memory_Objects; florist-gpl-2017-src/libsrc/posix-file_status.adb0000644000076700001450000002671713106553472021442 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . F I L E _ S T A T U S -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 1996-1997 Florida State University -- -- Copyright (C) 1998-2014, AdaCore -- -- -- -- This file is a component of FLORIST, an implementation of an Ada API -- -- for the POSIX OS services, for use with the GNAT Ada compiler and -- -- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended -- -- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD -- -- 1003.5b: 1996. -- -- -- -- FLORIST is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with POSIX.Implementation, POSIX.Permissions.Implementation, Unchecked_Conversion; package body POSIX.File_Status is use POSIX.C; use POSIX.Calendar; use POSIX.Implementation; use POSIX.Permissions.Implementation; function To_User_ID is new Unchecked_Conversion (uid_t, POSIX.Process_Identification.User_ID); function To_Group_ID is new Unchecked_Conversion (gid_t, POSIX.Process_Identification.Group_ID); pragma Warnings (Off); -- Disable warning that the representation of Time values may -- change between GNAT versions. function Duration_To_POSIX_Time is new Unchecked_Conversion (Duration, POSIX_Time); pragma Warnings (On); function stat (path : char_ptr; buf : stat_ptr) return int; pragma Import (C, stat, stat_LINKNAME); function lstat (path : char_ptr; buf : stat_ptr) return int; pragma Import (C, lstat, lstat_LINKNAME); function fstat (fildes : int; buf : stat_ptr) return int; pragma Import (C, fstat, fstat_LINKNAME); -- We had to redefine these functions in posix-macro.c. -- See the file for more info. ----------------------- -- Get_File_Status -- ----------------------- function Get_File_Status (Pathname : POSIX.Pathname) return Status is S : aliased struct_stat; Pathname_With_NUL : POSIX_String := Pathname & NUL; begin Check (stat (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, S'Unchecked_Access)); return Status (S); end Get_File_Status; ----------------------- -- Get_File_Status -- ----------------------- function Get_File_Status (File : POSIX.IO.File_Descriptor) return Status is S : aliased struct_stat; begin Check (fstat (int (File), S'Unchecked_Access)); return Status (S); end Get_File_Status; ----------------------- -- Get_Link_Status -- ----------------------- function Get_Link_Status (Pathname : POSIX.Pathname) return Status is S : aliased struct_stat; Pathname_With_NUL : POSIX_String := Pathname & NUL; begin Check (lstat (Pathname_With_NUL (Pathname_With_NUL'First)'Unchecked_Access, S'Unchecked_Access)); return Status (S); end Get_Link_Status; ------------------------- -- Permission_Set_Of -- ------------------------- function Permission_Set_Of (File_Status : Status) return POSIX.Permissions.Permission_Set is begin return Form_Ada_Permission (struct_stat (File_Status).st_mode); end Permission_Set_Of; ------------------ -- File_ID_Of -- ------------------ function File_ID_Of (File_Status : Status) return File_ID is begin return File_ID (struct_stat (File_Status).st_ino); end File_ID_Of; -------------------- -- Device_ID_Of -- -------------------- function Device_ID_Of (File_Status : Status) return Device_ID is begin return Device_ID (struct_stat (File_Status).st_dev); end Device_ID_Of; --------------------- -- Link_Count_Of -- --------------------- function Link_Count_Of (File_Status : Status) return Links is begin return Links (struct_stat (File_Status).st_nlink); end Link_Count_Of; ---------------- -- Owner_Of -- ---------------- function Owner_Of (File_Status : Status) return POSIX.Process_Identification.User_ID is begin return To_User_ID (struct_stat (File_Status).st_uid); end Owner_Of; ---------------- -- Group_Of -- ---------------- function Group_Of (File_Status : Status) return POSIX.Process_Identification.Group_ID is begin return To_Group_ID (struct_stat (File_Status).st_gid); end Group_Of; --------------- -- Size_Of -- --------------- function Size_Of (File_Status : Status) return POSIX.IO_Count is begin -- We depart from POSIX.5 5.3.2.3 (875) here, since the current -- POSIX C standard allows more cases of valid file descriptors -- for the st_size field, in particular symbolic links (the pathname -- length), shared memory objects, and typed memory objects. return IO_Count (struct_stat (File_Status).st_size); end Size_Of; --------------------------- -- Last_Access_Time_Of -- --------------------------- function Last_Access_Time_Of (File_Status : Status) return POSIX_Time is begin return Duration_To_POSIX_Time (Duration (struct_stat (File_Status).st_atime)); end Last_Access_Time_Of; --------------------------------- -- Last_Modification_Time_Of -- --------------------------------- function Last_Modification_Time_Of (File_Status : Status) return POSIX_Time is begin return Duration_To_POSIX_Time (Duration (struct_stat (File_Status).st_mtime)); end Last_Modification_Time_Of; ---------------------------------- -- Last_Status_Change_Time_Of -- ---------------------------------- function Last_Status_Change_Time_Of (File_Status : Status) return POSIX_Time is begin return Duration_To_POSIX_Time (Duration (struct_stat (File_Status).st_ctime)); end Last_Status_Change_Time_Of; -------------------- -- Is_Directory -- -------------------- function s_isdir (mode : mode_t) return int; pragma Import (C, s_isdir, "s_isdir"); function Is_Directory (File_Status : Status) return Boolean is begin return s_isdir (struct_stat (File_Status).st_mode) /= 0; end Is_Directory; --------------------------------- -- Is_Character_Special_File -- --------------------------------- function s_ischr (mode : mode_t) return int; pragma Import (C, s_ischr, "s_ischr"); function Is_Character_Special_File (File_Status : Status) return Boolean is begin return s_ischr (struct_stat (File_Status).st_mode) /= 0; end Is_Character_Special_File; ----------------------------- -- Is_Block_Special_File -- ----------------------------- function s_isblk (mode : mode_t) return int; pragma Import (C, s_isblk, "s_isblk"); function Is_Block_Special_File (File_Status : Status) return Boolean is begin return s_isblk (struct_stat (File_Status).st_mode) /= 0; end Is_Block_Special_File; ------------------------ -- Is_Symbolic_Link -- ------------------------ function s_islnk (mode : mode_t) return int; pragma Import (C, s_islnk, "s_islnk"); function Is_Symbolic_Link (File_Status : Status) return Boolean is begin return s_islnk (struct_stat (File_Status).st_mode) /= 0; end Is_Symbolic_Link; ----------------------- -- Is_Regular_FIle -- ----------------------- function s_isreg (mode : mode_t) return int; pragma Import (C, s_isreg, "s_isreg"); function Is_Regular_File (File_Status : Status) return Boolean is begin return s_isreg (struct_stat (File_Status).st_mode) /= 0; end Is_Regular_File; ----------------- -- Is_Socket -- ----------------- function s_issock (mode : mode_t) return int; pragma Import (C, s_issock, "s_issock"); function Is_Socket (File_Status : Status) return Boolean is begin return s_issock (struct_stat (File_Status).st_mode) /= 0; end Is_Socket; --------------- -- Is_FIFO -- --------------- function s_isfifo (mode : mode_t) return int; pragma Import (C, s_isfifo, "s_isfifo"); function Is_FIFO (File_Status : Status) return Boolean is begin return s_isfifo (struct_stat (File_Status).st_mode) /= 0; end Is_FIFO; ------------------------ -- Is_Shared_Memory -- ------------------------ function s_typeisshm (buf : stat_ptr) return int; pragma Import (C, s_typeisshm, "s_typeisshm"); function Is_Shared_Memory (File_Status : Status) return Boolean is begin return s_typeisshm (To_Stat_Ptr (File_Status'Address)) /= 0; end Is_Shared_Memory; ------------------------ -- Is_Message_Queue -- ------------------------ function s_typeismq (buf : stat_ptr) return int; pragma Import (C, s_typeismq, "s_typeismq"); function Is_Message_Queue (File_Status : Status) return Boolean is begin return s_typeismq (To_Stat_Ptr (File_Status'Address)) /= 0; end Is_Message_Queue; -------------------- -- Is_Semaphore -- -------------------- function s_typeissem (buf : stat_ptr) return int; pragma Import (C, s_typeissem, "s_typeissem"); function Is_Semaphore (File_Status : Status) return Boolean is begin return s_typeissem (To_Stat_Ptr (File_Status'Address)) /= 0; end Is_Semaphore; end POSIX.File_Status; florist-gpl-2017-src/gnatsocks/0000755000076700001450000000000013106553467016015 5ustar gnatmailgnatflorist-gpl-2017-src/gnatsocks/bug.adb0000644000076700001450000000513213106553473017240 0ustar gnatmailgnat----------------------------------------------------------------- -- file: bug.adb [$Revision: 110555 $] ----------------------------------------------------------------- -- Demonstrates incorrect implementation of record assignment. -- The bug appears at least in GNAT 3.10p, -- and the version of 3.11w we are using here (FSU). -- This problem seems to depend on: -- the alignment clause -- the representation clause -- the aliased component -- On Solaris 2.6 SuperSPARC (Sparcstation 20 HS14) the test -- fails, and prints: -- dad% ERROR: record assignment does not copy C.s_addr correctly. -- Addr.C.s_addr= 1 -- Tmp_Addr.in_addr.sin_addr.s_addr= 0 -- Assignment works OK at leaf component level. -- Tmp_Addr.in_addr.sin_addr.s_addr= 1 -- This bug came up in the Florist POSIX sockets interface. -- --Ted Baker (baker@cs.fsu.edu) with Ada.Text_IO; procedure bug is ALIGNMENT : constant := 8; type int16 is range -2**15 .. 2**15 - 1; type in_addr_t is mod 2**32; type struct_in_addr is record s_addr : in_addr_t; end record; for struct_in_addr'Alignment use ALIGNMENT; type Internet_Address is record C : struct_in_addr; end record; type struct_sockaddr_in is record sin_family : int16; sin_port : int16; sin_addr : struct_in_addr; sin_zero : String (1 .. 8); end record; for struct_sockaddr_in use record sin_family at 0 range 0 .. 15; sin_port at 2 range 0 .. 15; sin_addr at 4 range 0 .. 31; sin_zero at 8 range 0 .. 63; end record; type Internet_Socket_Address is record in_addr : aliased struct_sockaddr_in; end record; Addr : Internet_Address; Tmp_Addr : Internet_Socket_Address; begin Addr.C.s_addr := 1; Tmp_Addr.in_addr.sin_addr := Addr.C; if Tmp_Addr.in_addr.sin_addr.s_addr /= Addr.C.s_addr then Ada.Text_IO.Put_Line ("ERROR: record assignment does not copy C.s_addr correctly."); Ada.Text_IO.Put_Line ("Addr.C.s_addr=" & in_addr_t'Image (Addr.C.s_addr)); Ada.Text_IO.Put_Line ("Tmp_Addr.in_addr.sin_addr.s_addr=" & in_addr_t'Image (Tmp_Addr.in_addr.sin_addr.s_addr)); Tmp_Addr.in_addr.sin_addr.s_addr := Addr.C.s_addr; if Tmp_Addr.in_addr.sin_addr.s_addr = Addr.C.s_addr then Ada.Text_IO.Put_Line ("Assignment works OK at leaf component level."); Ada.Text_IO.Put_Line ("Tmp_Addr.in_addr.sin_addr.s_addr=" & in_addr_t'Image (Tmp_Addr.in_addr.sin_addr.s_addr)); end if; else Ada.Text_IO.Put_Line ("Assignment works OK."); end if; end bug; florist-gpl-2017-src/gnatsocks/multidb.adb0000644000076700001450000001405513106553473020127 0ustar gnatmailgnat-------------------------------------------------------------------------- -- file : multidb.adb [$Revision: 110555 $] -------------------------------------------------------------------------- -- This is a modification of "multiecho.adb", to implement instead -- a simple database. It illustrates the use of Ada direct I/O. -- The present version has at least one flaw. The socket input '!' -- is supposed to shut down the server, by aborting the main task. -- This is not working correctly, probably due to a bad interaction -- between the "accept" operation and the task abort. I need to look -- into this more, but you should not need this capability for your -- projects. -- Ted Baker with ada.characters.latin_1; with ada.exceptions; with ada.task_identification; with ada.text_io; with ada.direct_io; with sockets; with sockets.internet; with table; procedure multidb is use table; type connection_id is range 1..4; connections : array (connection_id) of sockets.stream_socket; procedure shut_down (e : ada.exceptions.exception_occurrence); main_task : ada.task_identification.task_id := ada.task_identification.current_task; -- used to shut down the entire program task type server_task; servers : array (connections'range) of server_task; lf : constant character := ada.characters.latin_1.lf; -- line-feed cr : constant character := ada.characters.latin_1.cr; -- carriage-return protected server_pool is entry await_turn; procedure next_turn; private turn : boolean := false; end server_pool; protected body server_pool is entry await_turn when turn is begin turn := false; end await_turn; procedure next_turn is begin turn := true; end next_turn; end server_pool; procedure writeln (outs : sockets.output_stream_ptr; s : string) is begin string'write (outs, s); character'write (outs, cr); character'write (outs, lf); end writeln; is_letter : array (character) of boolean := ('a'..'z' | 'A'..'Z' => true, others => false); procedure skipln (ins : sockets.input_stream_ptr) is c : character := ' '; begin while c /= lf loop character'read (ins, c); end loop; end skipln; procedure get_string (ins : sockets.input_stream_ptr; outs : sockets.output_stream_ptr; s : out string) is i : integer := s'first -1; c : character; begin string'write (outs, "enter a string of up to" & integer'image (s'length) & " letters: "); while i < s'last loop character'read (ins, c); exit when not is_letter (c); i := i + 1; s (i) := c; end loop; while i < s'last loop i := i + 1; s (i) := ' '; end loop; skipln (ins); end get_string; peer : sockets.internet.internet_socket_address; s : sockets.server_socket; task db_task is entry store (key : key_string; value : value_string); entry fetch (key : key_string; value : out value_string); end db_task; task body server_task is connection : sockets.stream_socket; ins : sockets.input_stream_ptr; outs : sockets.output_stream_ptr; ch : character; key : key_string; value : value_string; begin loop begin server_pool.await_turn; sockets.accept_connection (s, connection, peer); server_pool.next_turn; ins := sockets.get_input_stream (connection); outs := sockets.get_output_stream (connection); writeln (outs, "Hello!"); loop string'write (outs, "enter +, ?, ., or ! "); character'read (ins, ch); skipln (ins); case ch is when '+' => get_string (ins, outs, key); get_string (ins, outs, value); db_task.store (key, value); writeln (outs, "ok."); when '?' => get_string (ins, outs, key); db_task.fetch (key, value); writeln (outs, "value = " & value & '.'); when '.' => writeln (outs, "bye."); exit; when '!' => writeln (outs, "bye."); sockets.close (connection); sockets.close (s); abort db_task; ada.task_identification.abort_task (main_task); when others => null; end case; end loop; exception when others => null; end; sockets.close(connection); end loop; exception when e : others => shut_down (e); end server_task; task body db_task is begin loop begin select accept store (key : key_string; value : value_string) do set_value (key, value); end store; or accept fetch (key : key_string; value : out value_string) do value := table.value (key); end fetch; or terminate; end select; exception when others => null; end; end loop; end db_task; procedure shut_down (e : ada.exceptions.exception_occurrence) is begin ada.text_io.put_line ("main: " & ada.exceptions.exception_name (e) & ": " & ada.exceptions.exception_message (e)); sockets.close (s); abort db_task; ada.task_identification.abort_task (main_task); end shut_down; begin sockets.open (s, sockets.internet.new_address (sockets.internet.any_port, sockets.internet.all_local_addresses)); ada.text_io.put_line ("serving at: " & sockets.internet.get_addressstring ( sockets.internet.get_internet_address ( sockets.internet.get_address (s))) & " port " & sockets.internet.port_number'image ( sockets.internet.get_port ( sockets.internet.get_address (s)))); server_pool.next_turn; exception when e : others => shut_down (e); end multidb; florist-gpl-2017-src/gnatsocks/READ.ME0000644000076700001450000000355306602140742016750 0ustar gnatmailgnatGNATSOCKS This directory contains the code of GNATSOCKS, a simple object-oriented Ada interface for doing socket I/O. This is a personal project of mine, which I wrote originally for use by the students in my "Software Engineering with Ada" course, so that they could see how Ada 95 tagged types and imported subprograms work, and so that they would not have to waste time fiddling with the details of the UNIX C-language socket interfaces. The interfaces were inspired by the Java socket I/O classes. I'm making this code available to the general public in hope that it may be of some use, but anyone who uses it should beware that I do not consider it complete, nor have I tested it beyond the few simple test programs that are in this directory. The original Gnatsocks used hand-coded interfaces to the C-language socket I/O interfaces of the Solaris 2.6 operating system. The present version has been recoded in the form of an add-on to Florist (the FSU implementation of the POSIX Ada bindings). However, Gnatsocks does not depend on all of Florist -- just on the configuration mechanism and the a few packages (POSIX, POSIX.C, POSIX.C.Sockets). --Ted Baker (12 May 1998) READ.ME this file Makefile type "make" to compile everything sockets.ads socket ADT sockets.adb implementation sockets-internet.ads extension for internet sockets sockets-internet.adb implementation sockets-unix.ads extension for UNIX sockets sockets-unix.adb implementation sockettest.adb test program, reads one line from port 12 echoserver.adb test program, echos input from port 8189 test_socketsadb test program, calls and checks various interfaces os_interface.ads low-level interface to Solaris socket libraries os_interface.adb implementation errno_c.c low-level interface to C errno values Comments, suggestions, and bug-fixes are welcome. --Ted Baker (16 March 1997) florist-gpl-2017-src/gnatsocks/test_unix_sockets.adb0000644000076700001450000000034713106553473022243 0ustar gnatmailgnat-- The package Sockets.Unix has not been tested at all. -- This dummy test program just forces compilation, to check for -- syntax errors. with Sockets.Unix; procedure Text_Unix_Sockets is begin null; end Test_Unix_Sockets; florist-gpl-2017-src/gnatsocks/Makefile0000644000076700001450000000146406602140742017451 0ustar gnatmailgnat# makefile for Gnatsocks tests # LIBS = -lsocket -lnsl -largs FLORISTDIR = /part9/baker/florist-3.10p GNATMAKEFLAGS1 = -g -A$(FLORISTDIR)/floristlib -aO$(FLORISTDIR)/floristlib GNATMAKEFLAGS2 = -cargs -gnatg -largs $(LIBS) -lflorist TESTS = test_sockets sockettest echoserver multiecho multidb test_unix_sockets SOURCES = sockettest.adb sockets-internet.ads sockets-internet.adb\ sockets.ads sockets.adb sockets-unix.ads sockets-unix.adb\ echoserver.adb \ test_sockets.adb multiecho.adb test_pkg.ads test_pkg.adb\ table.adb table.ads multidb.adb\ test_unix_sockets.adb\ Makefile READ.ME all : $(TESTS) $(TESTS): %: %.adb \ $(FLORISTDIR)/floristlib/libflorist.a test_parameters.ads test_parameters.adb gnatmake $(GNATMAKEFLAGS1) $@ $(GNATMAKEFLAGS2) clean: -rm -f *~ *# *.o *.ali b_*.c $(TESTS) florist-gpl-2017-src/gnatsocks/sockets-internet.ads0000644000076700001450000001342113106553473022005 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- GNATSOCKS -- -- -- -- S o c k e t s . I n t e r n e t -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1997-1998 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- This file is a component of GNATSOCKS, an Ada interfaces to socket I/O -- -- services, for use with the GNAT Ada compiler. -- -- -- -- GNATSOCKS is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- [$Revision: 110555 $] package Sockets.Internet is type Port_Number is new POSIX.C.unsigned_short; Any_Port : constant Port_Number; -- specifies to Open for a server socket -- that it may assign any free port number type Internet_Address is private; All_Local_Addresses : constant Internet_Address; -- may be used with Open on a server socket to -- allow accepting connections for any local Internet address function Get_AddressString (Addr : Internet_Address) return String; -- returns dot-separated numeric internet address as string, -- e.g. "128.186.121.10". function Hash_Code (Addr : Internet_Address) return Integer; -- returns value suitable for use in a hash-table lookup function "=" (Left, Right : Internet_Address) return Boolean; -- returns true iff both have the same numeric address, -- not necessarily if both designate the same host function Get_AddrByName (Host : String) return Internet_Address; -- returns the address of the named host function Get_HostByAddr (Addr : Internet_Address) return String; -- returns the name of the host with given address function Local_Host return Internet_Address; -------------------------------------- type Internet_Address_Array is array (Positive range <>) of Internet_Address; function Get_AllByName (Host : String) return Internet_Address_Array; -- returns all the addresses of the named host -------------------------------------- type Internet_Socket_Address is new Socket_Address with private; function Get_Address (Addr : in Socket'Class) return Internet_Socket_Address; function New_Address (Port : Port_Number; Addr : Internet_Address := Local_Host) return Internet_Socket_Address; -- specifies the host address and port number of the socket address function New_Address (Port : Port_Number; Host : String) return Internet_Socket_Address; -- specifies the host name and port number of the socket address function Get_Internet_Address (Addr : Internet_Socket_Address) return Internet_Address; function Get_Port (Addr : Internet_Socket_Address) return Port_Number; -------------------------------------------------------- function Get_PeerAddress (Sock : Stream_Socket) return Internet_Socket_Address; -- return socket address of peer connected to open stream socket private type Internet_Address is record C : aliased POSIX.C.Sockets.struct_in_addr; end record; Any_Port : constant Port_Number := 0; All_Local_Addresses : constant Internet_Address := (C => (s_addr => POSIX.C.Netinet.INADDR_ANY)); function Address (Addr : Internet_Socket_Address) return POSIX.C.Sockets.sockaddr_ptr; function Length (Addr : Internet_Socket_Address) return POSIX.C.int; function Valid (Addr : Internet_Socket_Address) return Boolean; function Protocol_Family (Addr : Internet_Socket_Address) return POSIX.C.int; ----------------------------------- type Internet_Socket_Address is new Socket_Address with record in_addr : aliased POSIX.C.Sockets.struct_sockaddr_in; end record; end Sockets.Internet; florist-gpl-2017-src/gnatsocks/sockets.adb0000644000076700001450000003137413106553473020145 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- GNATSOCKS -- -- -- -- S o c k e t s -- -- -- -- B o d y -- -- -- -- -- -- Copyright (c) 1997-1998 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- This file is a component of GNATSOCKS, an Ada interfaces to socket I/O -- -- services, for use with the GNAT Ada compiler. -- -- -- -- GNATSOCKS is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- [$Revision: 110555 $] with Ada.Text_IO, Ada.Streams, POSIX, POSIX.C, POSIX.Implementation, System, Unchecked_Conversion; package body Sockets is use Ada.Text_IO, POSIX, POSIX.C, POSIX.C.Sockets, POSIX.Implementation; function close (fildes : int) return int; pragma Import (C, close, close_LINKNAME); procedure Close (Sock : in out Socket'Class) is begin if Sock.fd /= 0 then Check (close (Sock.fd)); end if; Sock.fd := 0; end Close; procedure Finalize (Sock : in out Socket) is begin Close (Sock); end Finalize; -------------------------------------- function connect (socket_fd : int; name : sockaddr_ptr; namelen : int) return int; pragma Import (C, connect, connect_LINKNAME); -- attempts to make a connection to a named socket. function make_socket (domain : int; socket_type : int; protocol : int) return int; pragma Import (C, make_socket, socket_LINKNAME); procedure Open (Sock : in out Stream_Socket; Addr : Socket_Address'Class) is begin if not Valid (Addr) then raise Constraint_Error; end if; if Sock.fd /= 0 then raise Constraint_Error; end if; Sock.fd := Check (make_socket (PF_INET, SOCK_STREAM, 0)); Check (connect (Sock.fd, Address (Addr), Length (Addr))); Sock.in_stream.sock := Sock'Unchecked_Access; Sock.in_ptr := Sock.in_stream'Unchecked_Access; Sock.out_stream.sock := Sock'Unchecked_Access; Sock.out_ptr := Sock.out_stream'Unchecked_Access; Sock.tag := Addr'Tag; end Open; function Get_Input_Stream (Sock : Stream_Socket) return Input_Stream_Ptr is begin if Sock.fd = 0 then raise Constraint_Error; end if; return Sock.in_ptr; end Get_Input_Stream; function Get_Output_Stream (Sock : Stream_Socket) return Output_Stream_Ptr is begin if Sock.fd = 0 then raise Constraint_Error; end if; return Sock.out_ptr; end Get_Output_Stream; ----------------------------------------- function listen (socket_fd : int; backlog : int) return int; pragma Import (C, listen, listen_LINKNAME); -- specifies that we want to listen on the argument socket ID. -- backlog is the number of backlogged connections that are allowed. -- To accept connections, a socket is first crated with socked(), -- a backlog for incoming connections is specified with listen(), -- and then the connections are accepted with accept(). function bind (socket_fd : int; name : sockaddr_ptr; namelen : int) return int; pragma Import (C, bind, bind_LINKNAME); -- assigns a name to an unnamed socket. -- A socket is first created with socket(). -- Binding a socket in the UNIX (not Internet) domain -- causes creation of a socket in the file system, that must -- be deleted later when it is no longer needed, using unlink() procedure Open (Sock : in out Server_Socket; Addr : Socket_Address'Class; Count : Natural := 0) is begin if not Valid (Addr) then raise Constraint_Error; end if; if Sock.fd /= 0 then raise Constraint_Error; end if; Sock.fd := Check (make_socket (Protocol_Family (Addr), SOCK_STREAM, 0)); Check (bind (Sock.fd, Address (Addr), Length (Addr))); Check (listen (Sock.fd, int (Count))); Sock.tag := Addr'Tag; end Open; function accept_connection (socket_fd : int; addr : sockaddr_ptr; addrlen : access int) return int; pragma Import (C, accept_connection, accept_LINKNAME); -- returns a socket ID for a new connection that has been -- requested via the socket whose ID is given as argument. -- The argument must be an existing socket that is bound to an address -- and is listeninf for connections. -- addr received the address of the connecting entity. procedure Accept_Connection (Server : Server_Socket; Stream : in out Stream_Socket'Class; Peer : in out Socket_Address'Class) is addrlen : aliased int := Length (Peer); use type Ada.Tags.Tag; begin if Server.fd = 0 then raise Constraint_Error; end if; if Stream.fd /= 0 then raise Constraint_Error; end if; if Server.tag /= Peer'Tag then raise Constraint_Error; end if; -- require that the Peer and Server object be of the same type as the -- socket address used to create the Server Stream.fd := Check (accept_connection (Server.fd, Address (Peer), addrlen'Unchecked_Access)); Stream.in_stream.sock := Stream'Unchecked_Access; Stream.in_ptr := Stream.in_stream'Unchecked_Access; Stream.out_stream.sock := Stream'Unchecked_Access; Stream.out_ptr := Stream.out_stream'Unchecked_Access; Stream.tag := Server.tag; if addrlen /= Length (Peer) then raise Constraint_Error; end if; end Accept_Connection; ----------------------------------------- procedure Open (Sock : in out Datagram_Socket; Addr : Socket_Address'Class) is begin if not Valid (Addr) then raise Constraint_Error; end if; if Sock.fd /= 0 then raise Constraint_Error; end if; Sock.fd := Check (make_socket (Protocol_Family (Addr), SOCK_DGRAM, 0)); Check (bind (Sock.fd, Address (Addr), Length (Addr))); Sock.tag := Addr'Tag; end Open; ----------------------------------------- function read (fildes : int; buf : System.Address; nbyte : size_t) return ssize_t; pragma Import (C, read, read_LINKNAME); function write (fildes : int; buf : char_ptr; nbyte : size_t) return ssize_t; pragma Import (C, write, write_LINKNAME); procedure Read (Stream : in out Input_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is use type Ada.Streams.Stream_Element_Offset; Tmp : ssize_t; function "+" is new Unchecked_Conversion (System.Address, char_ptr); begin Tmp := read (Stream.sock.fd, Item'Address, size_t (Item'Length)); Check (int (Tmp)); Last := Item'First + Ada.Streams.Stream_Element_Offset (Tmp); end Read; procedure Write (Stream : in out Input_Stream; Item : in Ada.Streams.Stream_Element_Array) is begin Raise_POSIX_Error (Operation_Not_Implemented); end Write; procedure Read (Stream : in out Output_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is begin Raise_POSIX_Error (Operation_Not_Implemented); end Read; procedure Write (Stream : in out Output_Stream; Item : in Ada.Streams.Stream_Element_Array) is function "+" is new Unchecked_Conversion (System.Address, char_ptr); begin Check (int (write (Stream.sock.fd, +Item'Address, size_t (Item'Length)))); end Write; ---------------------------------------------------- function sendto (socket_fd : int; buf : char_ptr; len : int; flags : int; from : sockaddr_ptr; fromlen : int_ptr) return int; pragma Import (C, sendto, sendto_LINKNAME); procedure Send (Sock : in Datagram_Socket; Addr : in Socket_Address'Class; Data : in String) is Data_With_NUL : POSIX_String; begin if not Valid (Addr) then raise Constraint_Error; end if; if Sock.fd /= 0 then raise Constraint_Error; end if; if Sock.tag /= Addr'Tag then raise Constraint_Error; end if; Check (sendto (socket_fd => Sock.fd, buf => +Data (Data'First)'Address, len => Data'Length, flags => 0, from => Address (Addr), fromlen => Length (Addr))); end Send; function recvfrom (socket_fd : int; buf : char_ptr; len : int; flags : int; from : sockaddr_ptr; -- may be null fromlen : int_ptr) return int; pragma Import (C, recvfrom, recvfrom_LINKNAME); procedure Receive (Sock : in Datagram_Socket; Addr : out Socket_Address'Class; Buff : in out String; Last : out Natural) is begin if not Valid (Addr) then raise Constraint_Error; end if; if Sock.fd /= 0 then raise Constraint_Error; end if; if Sock.tag /= Addr'Tag then raise Constraint_Error; end if; Check (recvfrom (socket_fd => Sock.fd, buf => +Buff (Buff'First)'Address, len => Buff'Length, flags => 0, from => Address (Buff), fromlen => Length (Addr))); end Receive; ---------------------------------------------------- -- Stuff that may be bound-to in future extensions? -- function getsockopt -- (socket_fd : int; -- level : int; -- optname : int; -- optval : char_ptr; -- optlen : int_ptr) -- return int; -- pragma Import (C, getsockopt, getsockopt_LINKNAME); -- -- get options associated with a socket -- function setsockopt -- (socket_fd : int; -- level : int; -- optname : int; -- optval : char_ptr; -- optlen : int) -- return int; -- pragma Import (C, setsockopt, setsockopt_LINKNAME); -- -- set options associated with a socket -- function recv -- (socket_fd : int; -- buf : char_ptr; -- len : int; -- flags : int) -- return int; -- pragma Import (C, recv, recv_LINKNAME); -- -- requires socket must be connected -- function send -- (socket_fd : int; -- buf : char_ptr; -- len : int; -- flags : int) -- return int; -- pragma Import (C, send, send_LINKNAME); -- -- requires socket must be connected -- function sendmsg -- (socket_fd : int; -- msg : struct_msghdr_ptr; -- flags : int) -- return int; -- pragma Import (C, recvmsg, recvmsg_LINKNAME); -- function recvmsg -- (socket_fd : int; -- msg : struct_msghdr_ptr; -- flags : int) -- return int; -- pragma Import (C, recvmsg, recvmsg_LINKNAME); -- other functions we may need? -- ioctl -- fcntl -- socketpair -- shutdown end Sockets; florist-gpl-2017-src/gnatsocks/sockets-unix.ads0000644000076700001450000000674013106553473021146 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- GNATSOCKS -- -- -- -- S o c k e t s . U n i x -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1997-1998 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- This file is a component of GNATSOCKS, an Ada interfaces to socket I/O -- -- services, for use with the GNAT Ada compiler. -- -- -- -- GNATSOCKS is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- [$Revision: 110555 $] with POSIX.C; package Sockets.Unix is type Unix_Socket_Address is new Socket_Address with private; function Get_Address (Sock : in Socket'Class) return Unix_Socket_Address; function New_Address (Path : String) return Unix_Socket_Address; -- specifies the pathname of the socket function Get_Path (Addr : Unix_Socket_Address) return String; private type Unix_Socket_Address is new Socket_Address with record un_addr : aliased POSIX.C.Sockets.struct_sockaddr_un; end record; function Address (Addr : Unix_Socket_Address) return POSIX.C.Sockets.sockaddr_ptr; function Length (Addr : Unix_Socket_Address) return POSIX.C.int; function Valid (Addr : Unix_Socket_Address) return Boolean; function Protocol_Family (Addr : Unix_Socket_Address) return POSIX.C.int; end Sockets.Unix; florist-gpl-2017-src/gnatsocks/multiecho.adb0000644000076700001450000001025613106553473020457 0ustar gnatmailgnat-------------------------------------------------------------------------- -- file : multiecho.adb [$Revision: 110555 $] -------------------------------------------------------------------------- -- This is a modification of "echoserver.adb", to allow multiple -- connections, using Ada tasks. -- waits for a client to attach to port 8189, then -- reads input from the client, a line at a time, and echos it. -- To run this program, type "java EchoServer", -- then put the job in the background -- or switch to another window, and type -- "telnet ", -- replacing by the name of -- the host on which you are running the echo-server -- and by the port number that the server printed -- out when it started up. -- This will connect you to the server. -- The server should be able to handle up to 4 concurrent connections. -- Use control-C to kill the server. with ada.characters.latin_1; with ada.exceptions; with ada.task_identification; with ada.text_io; with sockets; with sockets.internet; procedure multiecho is type connection_id is range 1..4; connections : array (connection_id) of sockets.stream_socket; procedure shut_down (e : ada.exceptions.exception_occurrence); main_task : ada.task_identification.task_id := ada.task_identification.current_task; -- used to shut down the entire program task type server_task; servers : array (connections'range) of server_task; lf : constant character := ada.characters.latin_1.lf; -- line-feed cr : constant character := ada.characters.latin_1.cr; -- carriage-return protected server_pool is entry await_turn; procedure next_turn; private turn : boolean := false; end server_pool; protected body server_pool is entry await_turn when turn is begin turn := false; end await_turn; procedure next_turn is begin turn := true; end next_turn; end server_pool; procedure writeln (outs : sockets.output_stream_ptr; s : string) is begin string'write (outs, s); character'write (outs, cr); character'write (outs, lf); end writeln; function readln (ins : sockets.input_stream_ptr) return string is buf : string (1 .. 1024); i : integer := 1; begin loop character'read (ins, buf (i)); exit when buf (i) = lf; i := i + 1; end loop; return buf (1 .. i-2); end readln; peer : sockets.internet.internet_socket_address; s : sockets.server_socket; task body server_task is connection : sockets.stream_socket; ins : sockets.input_stream_ptr; outs : sockets.output_stream_ptr; begin loop server_pool.await_turn; sockets.accept_connection (s, connection, peer); server_pool.next_turn; ins := sockets.get_input_stream (connection); outs := sockets.get_output_stream (connection); writeln (outs, "Hello! Enter BYE to exit."); loop declare str : string := readln (ins); begin exit when str (1..3) = "BYE"; writeln (outs, "Echo: """ & str & '"'); end; end loop; sockets.close(connection); end loop; exception when e : others => shut_down (e); end server_task; procedure shut_down (e : ada.exceptions.exception_occurrence) is begin ada.text_io.put_line ("main: " & ada.exceptions.exception_name (e) & ": " & ada.exceptions.exception_message (e)); sockets.close (s); ada.task_identification.abort_task (main_task); end shut_down; begin sockets.open (s, sockets.internet.new_address (sockets.internet.any_port, sockets.internet.all_local_addresses)); ada.text_io.put_line ("serving at: " & sockets.internet.get_addressstring ( -- & sockets.internet.get_hostbyaddr ( sockets.internet.get_internet_address ( sockets.internet.get_address (s))) & " port " & sockets.internet.port_number'image ( sockets.internet.get_port ( sockets.internet.get_address (s)))); server_pool.next_turn; exception when e : others => shut_down (e); end multiecho; florist-gpl-2017-src/gnatsocks/sockettest.adb0000644000076700001450000000156113106553473020655 0ustar gnatmailgnat----------------------------------------------------------------------------- -- file : socketest.adb [$Revision: 110555 $] ----------------------------------------------------------------------------- -- This is an indirect translation into GNAT Ada -- of the Java example in file "socketest.java". with ada.exceptions; with ada.text_io; with sockets; with sockets.internet; procedure sockettest is t : sockets.stream_socket; ins : sockets.input_stream_ptr; lf : constant character := character'val (10); ch : character := ' '; begin sockets.open (t, sockets.internet.new_address (12, "www.cs.fsu.edu")); ins := sockets.get_input_stream (t); while ch /= lf loop character'read (ins,ch); ada.text_io.put (ch); end loop; exception when e : others => ada.text_io.put_line ("error " & ada.exceptions.exception_name (e)); end sockettest; florist-gpl-2017-src/gnatsocks/sockets-unix.adb0000644000076700001450000001240213106553473021115 0ustar gnatmailgnat----------------------------------------------------------------------------- -- -- -- GNATSOCKS -- -- -- -- S o c k e t s . U n i x -- -- -- -- B o d y -- -- -- -- -- -- Copyright (c) 1997-1998 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- This file is a component of GNATSOCKS, an Ada interfaces to socket I/O -- -- services, for use with the GNAT Ada compiler. -- -- -- -- GNATSOCKS is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- [$Revision: 110555 $] with Ada.Finalization, Ada.Streams, POSIX.C, POSIX.Implementation, System, Unchecked_Conversion; package body Sockets.Unix is use POSIX, POSIX.C, POSIX.C.Sockets, POSIX.Implementation; function getsockname (socket_fd : int; name : sockaddr_var_ptr; namelen : access int) return int; pragma Import (C, getsockname, getsockname_LINKNAME); -- returns the current name for a socket function "+" is new Unchecked_Conversion (sockaddr_un_ptr, sockaddr_var_ptr); function "+" is new Unchecked_Conversion (sockaddr_un_ptr, sockaddr_ptr); function Get_Address (Sock : in Socket'Class) return Unix_Socket_Address is addr : aliased struct_sockaddr_un; addrlen : aliased int := addr'Size / char'Size; begin Check (getsockname (Sock.fd, +addr'Unchecked_Access, addrlen'Unchecked_Access)); if addrlen /= addr'Size / char'Size then raise Constraint_Error; end if; return (Socket_Address with un_addr => addr); end Get_Address; type String_Ptr is access all String; function New_Address (Path : String) return Unix_Socket_Address is addr : struct_sockaddr_un; function sptr_to_psptr is new Unchecked_Conversion (String_Ptr, POSIX_String_Ptr); begin if Path'Length > addr.sun_path'Length - 1 then raise Constraint_Error; end if; addr.sun_family := AF_UNIX; Nulterminate (addr.sun_path, Path); return (Socket_Address with un_addr => addr); end New_Address; function Get_Path (Addr : Unix_Socket_Address) return String is begin if Valid (Addr) then raise Constraint_Error; end if; return Form_String (Addr.un_addr.sun_path (1)'Unchecked_Access); end Get_Path; ---------------------------------------- function Address (Addr : Unix_Socket_Address) return sockaddr_ptr is begin return +Addr.un_addr'Unchecked_Access; end Address; function Length (Addr : Unix_Socket_Address) return POSIX.C.int is begin return Addr.un_addr'Size / char'Size; end Length; function Valid (Addr : Unix_Socket_Address) return Boolean is -- only the most basic validity check -- ... consider doing more? begin for I in Addr.un_addr.sun_path'Range loop if Addr.un_addr.sun_path (I) = NUL then return Addr.un_addr.sun_family = AF_UNIX; end if; end loop; return False; end Valid; function Protocol_Family (Addr : Unix_Socket_Address) return POSIX.C.int is begin return PF_UNIX; end Protocol_Family; end Sockets.Unix; florist-gpl-2017-src/gnatsocks/test_sockets.adb0000644000076700001450000000422613106553473021200 0ustar gnatmailgnat------------------------------------------------------------------------ -- file : test_sockets.adb [$Revision: 110555 $] ------------------------------------------------------------------------ -- The bare bones of a test for packages Sockets and Sockets.Internet. with Ada.Characters.Latin_1, POSIX_Report, Sockets, Sockets.Internet; procedure Test_Sockets is use POSIX_Report, Sockets, Sockets.Internet; Stream_Sock : Sockets.Stream_Socket; Server_Sock : Sockets.Server_Socket; In_Stream : Input_Stream_Ptr; Out_Strem : Output_Stream_Ptr; Lf : constant Character := Ada.Characters.Latin_1.Lf; Cr : constant Character := Ada.Characters.Latin_1.Cr; Localhost : Internet_Address; Telnet_Port : constant Port_Number := 23; Sockaddr : Internet_Socket_Address; begin Header ("Test_Sockets"); Test ("package Sockets"); declare Addr : Internet_Address; begin Test ("Local_Host"); Localhost := Local_Host; Test ("Get_Hostname"); declare Address : constant String := Get_AddressString (Localhost); begin Comment ("address = " & Address); declare Hostname : constant String := Get_HostByAddr (Localhost); begin Comment ("hostname = " & Hostname); Test ("Get_AddrByName"); Addr := Get_AddrByName (Hostname); Assert (Localhost = Addr, "A000: Get_AddrByName, Get_HostName"); end; end; Comment ("name of All_Local_Addresses = " & Get_HostByAddr (All_Local_Addresses)); exception when E : others => Fail (E, "A001"); end; declare Ch : Character; begin Test ("open stream socket to telnet port of local host"); Sockets.Open (Stream_Sock, Sockets.Internet.New_Address (Telnet_Port, Localhost)); In_Stream := Sockets.Get_Input_Stream (Stream_Sock); Test ("close"); Close (Stream_Sock); exception when E : others => Fail (E, "A002"); end; begin null; exception when E : others => Fail (E, "A003"); end; Done; exception when E : others => Fatal_Exception (E, "A004"); end Test_Sockets; florist-gpl-2017-src/gnatsocks/posix_report.ads0000644000076700001450000002754413106553473021254 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- POSIX.5b VALIDATION TEST SUITE -- -- -- -- P O S I X _ R E P O R T -- -- -- -- B o d y -- -- -- -- -- -- Copyright (c) 1997-1998 Florida State University (FSU). All Rights -- -- Reserved. -- -- -- -- This is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. This software is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- Under contract GS-35F-4506G, the U. S. Government obtained unlimited -- -- rights in the software and documentation contained herein. Unlimited -- -- rights are defined in DFAR 252,227-7013(a)(19). By making this public -- -- release, the Government intends to confer upon all recipients -- -- unlimited rights equal to those held by the Government. These rights -- -- include rights to use, duplicate, release or disclose the released -- -- data an computer software in whole or in part, in any manner and for -- -- any purpose whatsoever, and to have or permit others to do so. -- -- -- -- DISCLAIMER -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE -- -- AVAILABLE OR DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR -- -- IMPLIED WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS -- -- OF THE SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE -- -- AVAILABLE OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS -- -- FOR A PARTICULAR PURPOSE OF SAID MATERIAL. -- -- -- ------------------------------------------------------------------------------ -- [$Revision: 110555 $] with Ada.Exceptions, POSIX, POSIX_Process_Identification, POSIX_Process_Primitives; package POSIX_Report is -- This package contains utility routines which are useful for -- running tests. Verbose : Boolean := False; -- set to True if "-v" is on command line. Terse : Boolean := False; -- set to True if "-t" is on command line. Child : Natural := 0; -- set to 1 if "-child" is on command line -- set to NNN if "-child NNN" is on command line, where NNN is a number Test_Identifier : String := "POSIX Ada Validation Tests, Version 1.2a"; -- Call this once for each test program, at the beginning. -- It prints a message indicating that a test is about to be -- performed, regardless of whether verbose is turned on. -- User Root_OK = True if the test is one that makes sense to -- run as root. procedure Header (Label : String; Root_OK : Boolean := False); -- Call this once for each section of the test program. -- It prints a message indicating that a test is about to be -- performed, if verbose is turned on. -- The label should be unique so that if the test fails it is -- possible to find the code for the test by grepping through -- the source. procedure Test (Label : String); -- .... -- Fail is obsolescent. Use the more specific procedures. -- Call this to record the fact that a test failed. procedure Fail (Message : String); -- Call this from an exception handler for "others", to catch -- completion of test casem by an unhandled exception. procedure Fail (E : Ada.Exceptions.Exception_Occurrence; Message : String); -- Call this to check a condition that should be true. -- The test fails if the argument is false. procedure Assert (Condition : Boolean; Message : String); type POSIX_Option is (Asynchronous_IO_Option, Change_Owner_Restriction_Option, Filename_Truncation_Option, File_Synchronization_Option, Memory_Mapped_Files_Option, Memory_Locking_Option, Memory_Range_Locking_Option, Memory_Protection_Option, Message_Queues_Option, Mutex_Priority_Ceiling_Option, Mutex_Priority_Inheritance_Option, Mutex_Option, Prioritized_IO_Option, Priority_Process_Scheduling_Option, Priority_Task_Scheduling_Option, Process_Shared_Option, Realtime_Signals_Option, Job_Control_Option, Saved_IDs_Option, Semaphores_Option, Shared_Memory_Objects_Option, Signal_Entries_Option, Synchronized_IO_Option, Timers_Option); function Is_Supported (Option : POSIX_Option) return Boolean; -- Call this near the beginning of a test program -- that entirely depends on an option. It will end the test -- if the required option is not supported. procedure Optional (Option : POSIX_Option; Message : String); -- Call this inside an exception handler for an -- exception that may be raised in response to an -- attempt to use an optional feature that is not -- supported, where the feature depends on one option. procedure Optional (Option : POSIX_Option; Expected : POSIX.Error_Code; E : Ada.Exceptions.Exception_Occurrence; Message : String); -- Call this inside an exception handler for an -- exception that may be raised in response to an -- attempt to use an optional feature that is not -- supported, where the feature depends on two options. procedure Optional (Option_1 : POSIX_Option; Option_2 : POSIX_Option; Expected : POSIX.Error_Code; E : Ada.Exceptions.Exception_Occurrence; Message : String); -- Call this inside an exception handler for an -- exception that may be raised in response to an -- attempt to use an optional feature that is not -- supported, where POSIX_Error should be raised -- with a different error code if the option is supported. procedure Optional (Option : POSIX_Option; Expected_If_Not_Supported : POSIX.Error_Code; Expected_If_Supported : POSIX.Error_Code; E : Ada.Exceptions.Exception_Occurrence; Message : String); type POSIX_Privilege is (Memory_Locking_Privilege, Semaphore_Initialization_Privilege, Set_Time_Privilege); -- add more of these values as we discover more privileges -- Call this inside an exception handler for an -- exception that may be raised in response to an -- attempt to use an optional feature that is not -- supported, where the feature depends on one option -- and also depends on having appropriate privilege. procedure Privileged (Privilege : POSIX_Privilege; Option : POSIX_Option; Expected : POSIX.Error_Code; E : Ada.Exceptions.Exception_Occurrence; Message : String); procedure Privileged (Privilege : POSIX_Privilege; Message : String); -- Call this if the test is supposed to raise an exception, -- other than for nonsupport or lack of privilege. procedure Privileged (Privilege : POSIX_Privilege; Option : POSIX_Option; Expected_If_Not_Supported : POSIX.Error_Code; Expected_If_Supported : POSIX.Error_Code; E : Ada.Exceptions.Exception_Occurrence; Message : String); -- Call this at a point where control should not reach -- because an exception should have been raised. procedure Expect_Exception (Message : String); -- Call this inside an exception handler for an unexpected -- exception. procedure Unexpected_Exception (E : Ada.Exceptions.Exception_Occurrence; Message : String); -- Call this inside an exception handler for POSIX_Error, -- to validate that the expected error code is set. procedure Check_Error_Code (EC : POSIX.Error_Code; Message : String); -- Call this inside an exception handler for POSIX_Error, -- to validate that the expected error code is set. procedure Check_Error_Code (EC : POSIX.Error_Code; E : Ada.Exceptions.Exception_Occurrence; Message : String); -- Call this inside an exception handler for any exception -- to check that the exception message is correct. procedure Check_Message (E : Ada.Exceptions.Exception_Occurrence; Expected_Message : String; Message : String); -- Call this from an exception handler for "others", to catch -- completion of test program by an unhandled exception. procedure Fatal_Exception (E : Ada.Exceptions.Exception_Occurrence; Message : String); -- Call this to print out a an informational message, -- iff Verbose = True. -- It does not imply that anything went wrong. procedure Comment (Msg : String); -- Call this to get a printable string for a Timepsec value. function Image (T : POSIX.Timespec) return String; -- This is equivalent to Comment (Msg & " = " & Image (T)); procedure Comment (Msg : String; T : POSIX.Timespec); -- Call this to add to this package's internal error count. procedure Increment_Error_Count (Number : Integer); -- Call this to get this package's internal error count. function Get_Error_Count return Integer; -- Call this once, before exiting, when the testing is complete, -- for normal completion of a main program. procedure Done; -- Call this to terminate a test immediately. procedure Fatal (Msg : String); -- Add to the given argument list the necessary values to pass -- through the verbose/normal/terse state of the parent process. procedure Pass_Through_Verbosity (Args : in out POSIX.POSIX_String_List); -- Check Termination_Status value of child process, to verify -- that the child exited and exited with the anticipated status. -- Add the error count of the child process to that of the parent. procedure Check_Child_Status (Status : POSIX_Process_Primitives.Termination_Status; Child_ID : POSIX_Process_Identification.Process_ID; Expected : POSIX_Process_Primitives.Exit_Status; Message : String); private -- name of the executable file for this program Program_Name : String (1 .. 128) := (others => ' '); Program_Name_Length : Integer := 0; -- label from the last Test subprogram call Test_Label : String (1 .. 128) := (others => ' '); Test_Label_Length : Integer := 0; -- an option has been found to be unsupported Nonsupport : array (POSIX_Option) of Boolean := (others => False); pragma Atomic_Components (Nonsupport); -- an operation has failed due to insufficient privilege Privilege_Failure : Boolean := False; pragma Atomic (Privilege_Failure); -- number of errors so far Error_Count : Natural := 0; pragma Atomic (Error_Count); end POSIX_Report; florist-gpl-2017-src/gnatsocks/table.ads0000644000076700001450000000322413106553473017573 0ustar gnatmailgnat----------------------------------------------------------------------- -- file : table.ads [$Revision: 110555 $] ----------------------------------------------------------------------- -- See file READ.ME for explanation of this and the other examples. -- Uppercase characters are used for emphasis of new features -- in this example, as compared with the other examples. package table is subtype key_string is string (1..10); subtype value_string is string (1..16); procedure set_value (key : in key_string; value : in value_string); function has_value (key : in key_string) return boolean; function value (key : in key_string) return value_string; generic with procedure action (key : in key_string; value : in value_string); procedure enumerate; not_found : exception; overflow : exception; end table; -- Table is an abstract data object that provides the -- ability to define a mapping from a finite set of strings -- of a given fixed length to strings of another fixed length. -- Set_Value attempts to modify Table, so that Key is mapped to Value. -- It raises Overflow if there is not enough space left in Table. -- Has_Value returns True iff Table contains a mapping for Key. -- It does not raise any exceptions. -- Value returns the value to which Key is mapped by Table, if -- Table contains a mapping for Key. -- Otherwise, Value raises Not_Found. -- Generic procedure Enumerate must be instantiated with a specific -- Action procedure to create a callable subprogram. The instantiation -- is a procedure that takes no argument, and calls the -- Action procedure for each (Key, Value) pair in Table. florist-gpl-2017-src/gnatsocks/table.adb0000644000076700001450000000405713106553473017557 0ustar gnatmailgnat-- file : table.adb [$Revision: 110555 $] -- See package body (file tables.adb) for header comments. -- This implementation of the package uses a fixed-size array -- representation. What about other representations? -- Ted Baker, 13 January 1997 PACKAGE BODY TABLE IS Table_Size : constant := 100; Last_Entry : Natural := 0; type Pair is record Key : Key_String; Value : Value_String; end record; type Table_Type is array (1..Table_Size) of Pair; The_Table: Table_Type; procedure Set_Value (Key : in Key_String; Value : in Value_String) is begin for I in The_Table'First .. Last_Entry loop if The_Table(I).Key = Key then The_Table(I).Value := Value; return; end if; end loop; if Last_Entry = Table_Size then raise Overflow; end if; Last_Entry := Last_Entry + 1; The_Table(Last_Entry) := (Key=> Key, Value=> Value); end Set_Value; function Has_Value (Key : in Key_String) return Boolean is begin for I in The_Table'First .. Last_Entry loop if The_Table(I).Key = Key then return True; end if; end loop; return False; end Has_Value; function Value (Key : in Key_String) return Value_String is begin for I in The_Table'First .. Last_Entry loop if The_Table(I).Key = Key then return The_Table(I).Value; end if; end loop; raise Not_Found; end Value; -- generic -- with procedure Action (Key : in Key_String; Value : in Value_String); procedure Enumerate is begin for I in The_Table'First .. Last_Entry loop Action (The_Table(I).Key, The_Table(I).Value); end loop; end Enumerate; END TABLE; ---------------------- -- REVISION HISTORY -- ---------------------- -- ---------------------------- -- revision 1.1 -- date: 1997/02/26 15:29:22; author: baker; state: Exp; -- Initial revision -- ---------------------------- -- New changes after this line. Each line starts with: "-- " -- This version is just to check how the "checkin" and "checkout" scripts -- are working. florist-gpl-2017-src/gnatsocks/gnatsocks.ads0000644000076700001450000001717713106553473020514 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- GNATSOCKS -- -- -- -- S o c k e t s -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1997-1998 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- This file is a component of GNATSOCKS, an Ada interfaces to socket I/O -- -- services, for use with the GNAT Ada compiler. -- -- -- -- GNATSOCKS is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- [$Revision: 110555 $] -- This package is intended to provide convenient access to socket I/O. -- It still needs design, documentation, and implementation work -- to specify what happens if an error occurs, -- for each of the operations. with Ada.Finalization, Ada.Streams, Ada.Tags, POSIX.C, POSIX.C.Sockets; package Sockets is -------------------------------------- type Socket_Address is abstract tagged private; -------------------------------------- type Socket is abstract tagged limited private; procedure Close (Obj : in out Socket'Class); -- closes the socket function Get_Address (Obj : in Socket'Class) return Socket_Address is abstract; -- gets address of socket -------------------------------------- type Input_Stream is new Ada.Streams.Root_Stream_Type with private; type Input_Stream_Ptr is access all Input_Stream; type Output_Stream is new Ada.Streams.Root_Stream_Type with private; type Output_Stream_Ptr is access all Output_Stream; -------------------------------------- type Stream_Socket is new Socket with private; procedure Open (Sock : in out Stream_Socket; Addr : Socket_Address'Class); -- creates a stream socket and connects it to the specified address function Get_Input_Stream (Obj : Stream_Socket) return Input_Stream_Ptr; function Get_Output_Stream (Obj : Stream_Socket) return Output_Stream_Ptr; -------------------------------------- type Server_Socket is new Socket with private; procedure Open (Sock : in out Server_Socket; Addr : Socket_Address'Class; Count : Natural := 0); -- creates a server socket on the specified port -- with the specified backlog count procedure Accept_Connection (Server : Server_Socket; Stream : in out Stream_Socket'Class; Peer : in out Socket_Address'Class); -- accept connection addressed to Server socket, and -- open Stream socket to handle the connection. -------------------------------------- type Datagram_Socket is new Socket with private; procedure Open (Sock : in out Datagram_Socket; Addr : Socket_Address'Class); -- creates a datagram socket on the specified port -- with the specified local address -- This part is "in progress". We will add support for datagram sockets, -- including send and receive operations. -- Issues to address include whether to use type to distinguish connected -- from non-connected datagram sockets (so as to tell whether to use send/recv -- or sendto/recfrom), and whether to allow bind for sending. -- Note that INADDR_ANY can be used for bind, to let system choose -- the local IP address, for bind private function Address (Obj : Socket_Address) return POSIX.C.Sockets.struct_sockaddr_ptr is abstract; function Length (Obj : Socket_Address) return Interfaces.C.int is abstract; function Valid (Obj : Socket_Address) return Boolean is abstract; function Protocol_Family (Obj : Socket_Address) return Interfaces.C.int is abstract; type Socket_Address is abstract tagged null record; ----------------------------------- type Socket is new Ada.Finalization.Limited_Controlled with record fd : Interfaces.C.int := 0; -- file descriptor of an open socket, of nonzero tag : Ada.Tags.Tag; -- tag of the socket address type used to open the socket, of fd /= 0 -- This is used to check that other operations use only addresses -- that are in the same family. end record; procedure Finalize (Obj : in out Socket); ----------------------------------- type Stream_Socket_Ptr is access all Stream_Socket; type Input_Stream is new Ada.Streams.Root_Stream_Type with record sock : Stream_Socket_Ptr; end record; type Output_Stream is new Ada.Streams.Root_Stream_Type with record sock : Stream_Socket_Ptr; end record; type Stream_Socket is new Socket with record in_stream : aliased Input_Stream; out_stream : aliased Output_Stream; in_ptr : Input_Stream_Ptr; -- points to in_stream out_ptr : Output_Stream_Ptr; -- points to out_stream -- These pointers are needed to implement -- functions Get_InputStream and Get_OutputStream. end record; procedure Read (Stream : in out Input_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset); procedure Write (Stream : in out Input_Stream; Item : in Ada.Streams.Stream_Element_Array); procedure Read (Stream : in out Output_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset); procedure Write (Stream : in out Output_Stream; Item : in Ada.Streams.Stream_Element_Array); ----------------------------------- type Server_Socket is new Socket with null record; ----------------------------------- type Datagram_Socket is new Socket with null record; end Sockets; florist-gpl-2017-src/gnatsocks/posix_report.adb0000644000076700001450000007137213106553473021231 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- POSIX.5b VALIDATION TEST SUITE -- -- -- -- P O S I X _ R E P O R T -- -- -- -- B o d y -- -- -- -- -- -- Copyright (c) 1997-1998 Florida State University (FSU). All Rights -- -- Reserved. -- -- -- -- This is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. This software is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- Under contract GS-35F-4506G, the U. S. Government obtained unlimited -- -- rights in the software and documentation contained herein. Unlimited -- -- rights are defined in DFAR 252,227-7013(a)(19). By making this public -- -- release, the Government intends to confer upon all recipients -- -- unlimited rights equal to those held by the Government. These rights -- -- include rights to use, duplicate, release or disclose the released -- -- data an computer software in whole or in part, in any manner and for -- -- any purpose whatsoever, and to have or permit others to do so. -- -- -- -- DISCLAIMER -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE -- -- AVAILABLE OR DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR -- -- IMPLIED WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS -- -- OF THE SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE -- -- AVAILABLE OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS -- -- FOR A PARTICULAR PURPOSE OF SAID MATERIAL. -- -- -- ------------------------------------------------------------------------------ -- [$Revision: 110555 $] with Ada.Command_Line, Ada.Text_IO, POSIX_Configurable_System_Limits, POSIX_Options, POSIX_Process_Identification, POSIX_Process_Primitives, POSIX_Signals; pragma Elaborate_All (POSIX_Process_Identification); package body POSIX_Report is use Ada.Command_Line, Ada.Exceptions, Ada.Text_IO, POSIX, POSIX_Configurable_System_Limits, POSIX_Process_Identification, POSIX_Process_Primitives, POSIX_Options, POSIX_Signals; subtype Exit_Status is POSIX_Process_Primitives.Exit_Status; ------------------------- -- Local Subprograms -- ------------------------- function Option_Name (Option : POSIX_Option) return String; function Option_Name (Option : POSIX_Option) return String is begin case Option is when Asynchronous_IO_Option => return "Asynchronous IO"; when Change_Owner_Restriction_Option => return "Change Owner Restriction"; when Filename_Truncation_Option => return "Filename Truncation"; when File_Synchronization_Option => return "File Synchronization"; when Memory_Mapped_Files_Option => return "Memory Mapped Files"; when Memory_Locking_Option => return "Memory Locking"; when Memory_Range_Locking_Option => return "Memory Range Locking"; when Memory_Protection_Option => return "Memory Protection"; when Message_Queues_Option => return "Message Queues"; when Mutex_Priority_Ceiling_Option => return "Mutex Priority Ceiling"; when Mutex_Priority_Inheritance_Option => return "Mutex Priority Inheritance"; when Mutex_Option => return "Mutexes"; when Prioritized_IO_Option => return "Prioritized IO"; when Priority_Process_Scheduling_Option => return "Priority Process Scheduling"; when Priority_Task_Scheduling_Option => return "Priority Task Scheduling"; when Process_Shared_Option => return "Process Shared"; when Realtime_Signals_Option => return "Realtime Signals"; when Saved_IDs_Option => return "Saved IDs"; when Job_Control_Option => return "Job Control"; when Semaphores_Option => return "Semaphores"; when Shared_Memory_Objects_Option => return "Shared Memory"; when Signal_Entries_Option => return "Signal Entries"; when Synchronized_IO_Option => return "Synchronized IO"; when Timers_Option => return "Timers"; end case; end Option_Name; function int_to_uid (Id : Integer) return POSIX_Process_Identification.User_ID; function int_to_uid (Id : Integer) return POSIX_Process_Identification.User_ID is begin return Value (Integer'Image (Id)); end int_to_uid; ----------------------- -- Local Variables -- ----------------------- Super_User_ID : User_ID := int_to_uid (0); procedure Header (Label : String; Root_OK : Boolean := False) is Saved_Verbose : Boolean := Verbose; Empty_String : String := ""; begin Put_Line (",.,. " & Label & " " & Test_Identifier); if Get_Real_User_ID = Super_User_ID and then not Root_OK then Fail ("For safety reasons, the test program should not be " & "run as root"); Done; Exit_Process (Exit_Status'Last); end if; Program_Name_Length := Label'Length; if Program_Name_Length > Program_Name'Length then Program_Name_Length := Program_Name'Length; end if; Program_Name (1 .. Program_Name_Length) := Label (Program_Name'First .. Program_Name'First + Program_Name_Length - 1); exception when E : others => Fatal_Exception (E, "in Header"); end Header; procedure Test (Label : String) is Empty_String : String := ""; begin if not Terse then Put_Line ("---- *-Subtest: " & Label); Flush; end if; Test_Label_Length := Label'Length; if Test_Label_Length > Test_Label'Length then Test_Label_Length := Test_Label'Length; end if; Test_Label (1 .. Test_Label_Length) := Label (Label'First .. Label'First + Test_Label_Length - 1); end Test; procedure Fail (Message : String) is begin Put_Line (" !!TEST FAILED: " & Message); Flush; Error_Count := Error_Count + 1; end Fail; procedure Fail (E : Exception_Occurrence; Message : String) is begin Put (" !!TEST FAILED: " & Exception_Name (E)); if Message = "" then if Exception_Message (E) = "" then New_Line; else Put_Line (": " & Exception_Message (E)); end if; elsif Exception_Message (E) = "" then Put_Line (": " & Message); else Put_Line (": " & Exception_Message (E) & ": " & Message); end if; Error_Count := Error_Count + 1; end Fail; procedure Assert (Condition : Boolean; Message : String) is begin if not Condition then if Message = "" then Fail ("assert"); else Fail ("assert [" & Message & "]"); end if; end if; end Assert; procedure Expect_Exception (Message : String) is begin Fail ("exception not raised [" & Message & "]"); end Expect_Exception; procedure Unexpected_Exception (E : Ada.Exceptions.Exception_Occurrence; Message : String) is begin Fail ("exception " & Exception_Name (E) & " [" & Message & "]"); if Exception_Message (E) /= "" and then Verbose then Put_Line (" -- Exception message = " & Exception_Message (E)); Flush; end if; end Unexpected_Exception; procedure Check_Error_Code (EC : POSIX.Error_Code; Message : String) is E : POSIX.Error_Code := POSIX.Get_Error_Code; begin if E /= EC then Fail ("incorrect error code: " & POSIX.Image (E)); Comment ("Expected error code: " & POSIX.Image (EC)); Flush; end if; end Check_Error_Code; procedure Check_Error_Code (EC : POSIX.Error_Code; E : Ada.Exceptions.Exception_Occurrence; Message : String) is EEC : POSIX.Error_Code := POSIX.Get_Error_Code; begin if Exception_Identity (E) /= POSIX_Error'Identity then Fail (E, Message); elsif EEC /= EC then if Message = "" then Fail ("incorrect error code " & POSIX.Image (EEC) & " [expected " & POSIX.Image (EC) & "]"); else Fail ("incorrect error code " & POSIX.Image (EEC) & " [expected " & POSIX.Image (EC) & "]" & ": " & Message); end if; elsif Exception_Message (E) /= "" and then Exception_Message (E) /= POSIX.Image (EC) then if Message = "" then Fail ("incorrect Exception_Message: " & Exception_Message (E)); else Fail ("incorrect Exception_Message: " & Exception_Message (E) & ": " & Message); end if; end if; end Check_Error_Code; procedure Check_Message (E : Ada.Exceptions.Exception_Occurrence; Expected_Message : String; Message : String) is begin if Exception_Message (E) /= Expected_Message then Fail (Message & ": message is not " & Expected_Message); end if; end Check_Message; procedure Comment (Msg : String) is begin if Verbose then Put_Line (" -- " & Msg); Flush; end if; end Comment; function Image (T : POSIX.Timespec) return String is S : Seconds; NS : Nanoseconds; Z : constant Integer := Character'Pos ('0'); begin Split (T, S, NS); declare SBuff : String (1 .. 9) := "000000000"; I : Integer := SBuff'Last; begin while NS > 0 loop SBuff (I) := Character'Val (Z + Integer (NS rem 10)); NS := NS / 10; I := I - 1; end loop; return Seconds'Image (S) & "." & SBuff & "s"; end; end Image; procedure Comment (Msg : String; T : POSIX.Timespec) is begin Comment (Msg & " = " & Image (T)); end Comment; function Is_Supported (Option : POSIX_Option) return Boolean is use POSIX_Configurable_System_Limits; begin case Option is when Asynchronous_IO_Option => if True in Asynchronous_IO_Support then if False in Asynchronous_IO_Support then return Asynchronous_IO_Is_Supported; end if; else return False; end if; when Change_Owner_Restriction_Option => raise Constraint_Error; when Filename_Truncation_Option => raise Constraint_Error; when File_Synchronization_Option => if True in File_Synchronization_Support then if False in File_Synchronization_Support then return File_Synchronization_Is_Supported; end if; else return False; end if; when Memory_Mapped_Files_Option => if True in Memory_Mapped_Files_Support then if False in Memory_Mapped_Files_Support then return Memory_Mapped_Files_Are_Supported; end if; else return False; end if; when Memory_Locking_Option => if True in Memory_Locking_Support then if False in Memory_Locking_Support then return Memory_Locking_Is_Supported; end if; else return False; end if; when Memory_Range_Locking_Option => if True in Memory_Range_Locking_Support then if False in Memory_Range_Locking_Support then return Memory_Range_Locking_Is_Supported; end if; else return False; end if; when Memory_Protection_Option => if True in Memory_Protection_Support then if False in Memory_Protection_Support then return Memory_Protection_Is_Supported; end if; else return False; end if; when Message_Queues_Option => if True in Message_Queues_Support then if False in Message_Queues_Support then return Message_Queues_Are_Supported; end if; else return False; end if; when Mutex_Priority_Ceiling_Option => if True in Mutex_Priority_Ceiling_Support then if False in Mutex_Priority_Ceiling_Support then return Mutex_Priority_Ceiling_Is_Supported; end if; else return False; end if; when Mutex_Priority_Inheritance_Option => if True in Mutex_Priority_Inheritance_Support then if False in Mutex_Priority_Inheritance_Support then return Mutex_Priority_Inheritance_Is_Supported; end if; else return False; end if; when Mutex_Option => if True in Mutexes_Support then if False in Mutexes_Support then return Mutexes_Are_Supported; end if; else return False; end if; when Prioritized_IO_Option => if True in Prioritized_IO_Support then if False in Prioritized_IO_Support then return Prioritized_IO_Is_Supported; end if; else return False; end if; when Priority_Process_Scheduling_Option => if True in Priority_Process_Scheduling_Support then if False in Priority_Process_Scheduling_Support then return Priority_Process_Scheduling_Is_Supported; end if; else return False; end if; when Priority_Task_Scheduling_Option => if True in Priority_Task_Scheduling_Support then if False in Priority_Task_Scheduling_Support then return Priority_Task_Scheduling_Is_Supported; end if; else return False; end if; when Process_Shared_Option => if True in Process_Shared_Support then if False in Process_Shared_Support then return Process_Shared_Is_Supported; end if; else return False; end if; when Realtime_Signals_Option => if True in Realtime_Signals_Support then if False in Realtime_Signals_Support then return Realtime_Signals_Are_Supported; end if; else return False; end if; when Job_Control_Option => if True in POSIX.Job_Control_Support then if False in POSIX.Job_Control_Support then return Job_Control_Is_Supported; end if; else return False; end if; when Saved_IDs_Option => if True in POSIX.Saved_IDs_Support then if False in POSIX.Saved_IDs_Support then return Saved_IDs_Are_Supported; end if; else return False; end if; when Semaphores_Option => if True in Semaphores_Support then if False in Semaphores_Support then return Semaphores_Are_Supported; end if; else return False; end if; when Shared_Memory_Objects_Option => if True in Shared_Memory_Objects_Support then if False in Shared_Memory_Objects_Support then return Shared_Memory_Objects_Are_Supported; end if; else return False; end if; when Signal_Entries_Option => if True in Signal_Entries_Support then if False in Signal_Entries_Support then return True; end if; else return False; end if; when Synchronized_IO_Option => if True in Synchronized_IO_Support then if False in Synchronized_IO_Support then return Synchronized_IO_Is_Supported; end if; else return False; end if; when Timers_Option => if True in Timers_Support then if False in Timers_Support then return Timers_Are_Supported; end if; else return False; end if; end case; return True; end Is_Supported; procedure Optional (Option : POSIX_Option; Message : String) is begin if not Is_Supported (Option) then if Message /= "" then Comment (POSIX_Option'Image (Option) & " required: " & Message); else Comment (POSIX_Option'Image (Option) & " required"); end if; Nonsupport (Option) := True; for I in Nonsupport'Range loop if Nonsupport (I) then Put ("**** Nonsupport of "&POSIX_Option'Image (I)&" detected."); New_Line; end if; end loop; Put_Line ("==== Test Not Applicable."); Exit_Process (Normal_Exit); end if; end Optional; procedure Optional (Option : POSIX_Option; Expected : POSIX.Error_Code; E : Ada.Exceptions.Exception_Occurrence; Message : String) is begin if Is_Supported (Option) or else POSIX.Get_Error_Code /= Expected then Fail (E, Message); elsif Message = "" then Comment (POSIX_Option'Image (Option) & " not supported"); Nonsupport (Option) := True; else Comment (POSIX_Option'Image (Option) & " not supported [" & Message & "]"); Nonsupport (Option) := True; end if; exception when E1 : others => Fail (E1, "checking for support of " & POSIX_Option'Image (Option)); end Optional; procedure Optional (Option_1 : POSIX_Option; Option_2 : POSIX_Option; Expected : POSIX.Error_Code; E : Ada.Exceptions.Exception_Occurrence; Message : String) is begin if (Is_Supported (Option_1) and then Is_Supported (Option_2)) or else POSIX.Get_Error_Code /= Expected then Fail (E, Message); else if not Is_Supported (Option_1) then if Message = "" then Comment (POSIX_Option'Image (Option_1) & " not supported"); Nonsupport (Option_1) := True; else Comment (POSIX_Option'Image (Option_1) & " not supported [" & Message & "]"); Nonsupport (Option_1) := True; end if; end if; if not Is_Supported (Option_2) then if Message = "" then Comment (POSIX_Option'Image (Option_2) & " not supported"); Nonsupport (Option_2) := True; else Comment (POSIX_Option'Image (Option_2) & " not supported [" & Message & "]"); Nonsupport (Option_2) := True; end if; end if; end if; exception when E1 : others => Fail (E1, "checking for support of options"); end Optional; procedure Optional (Option : POSIX_Option; Expected_If_Not_Supported : POSIX.Error_Code; Expected_If_Supported : POSIX.Error_Code; E : Ada.Exceptions.Exception_Occurrence; Message : String) is begin if Is_Supported (Option) then if POSIX.Get_Error_Code /= Expected_If_Supported then Fail (E, Message); end if; elsif POSIX.Get_Error_Code /= Expected_If_Not_Supported then Fail (E, Message); else if Message = "" then Comment (POSIX_Option'Image (Option) & " not supported"); Nonsupport (Option) := True; else Comment (POSIX_Option'Image (Option) & " not supported [" & Message & "]"); Nonsupport (Option) := True; end if; end if; exception when E1 : others => Fail (E1, "checking for support of options"); end Optional; function Uid_To_Integer (Uid : POSIX_Process_Identification.User_ID) return Integer; -- .... not portable; needs configurable mechanism function Uid_To_Integer (Uid : POSIX_Process_Identification.User_ID) return Integer is begin return Integer'Value (POSIX_Process_Identification.Image (Uid)); end Uid_To_Integer; procedure Privileged (Privilege : POSIX_Privilege; Option : POSIX_Option; Expected : POSIX.Error_Code; E : Ada.Exceptions.Exception_Occurrence; Message : String) is Error : constant POSIX.Error_Code := POSIX.Get_Error_Code; begin if Error = Operation_Not_Permitted then Fail (E, Message & " - insufficient privilege"); Privilege_Failure := True; return; end if; if Is_Supported (Option) or else Error /= Expected then Fail (E, Message); elsif Message = "" then Comment (POSIX_Option'Image (Option) & " not supported"); Nonsupport (Option) := True; else Comment (POSIX_Option'Image (Option) & " not supported [" & Message & "]"); Nonsupport (Option) := True; end if; exception when E1 : others => Fail (E1, "checking for support of " & POSIX_Option'Image (Option)); end Privileged; procedure Privileged (Privilege : POSIX_Privilege; Message : String) is Error : constant POSIX.Error_Code := POSIX.Get_Error_Code; begin if Error = Operation_Not_Permitted then -- .... This is temporary. -- For the longer term, there should be a locally configurable -- mechanism for determining whether we have appropriate -- privilege for various operations. For now, we assume that -- appropriate privilege is equivalent to having root user-id. if (Uid_To_Integer (POSIX_Process_Identification.Get_Effective_User_ID) = 0) then Fail ("should have appropriate privilege"); end if; end if; end Privileged; procedure Privileged (Privilege : POSIX_Privilege; Option : POSIX_Option; Expected_If_Not_Supported : POSIX.Error_Code; Expected_If_Supported : POSIX.Error_Code; E : Ada.Exceptions.Exception_Occurrence; Message : String) is Error : constant POSIX.Error_Code := POSIX.Get_Error_Code; begin if Error = Operation_Not_Permitted then Fail (E, Message & " - insufficient privilege"); Privilege_Failure := True; return; end if; Optional (Option, Expected_If_Not_Supported, Expected_If_Supported, E, Message); end Privileged; procedure Increment_Error_Count (Number : Integer) is begin Error_Count := Error_Count + 1; end Increment_Error_Count; function Get_Error_Count return Integer is begin return Error_Count; end Get_Error_Count; procedure Done is begin if Error_Count = 0 and not Privilege_Failure then if Child /= 0 then Comment ("child process completed successfully"); else Put_Line ("==== Test Completed Successfully."); end if; else if Privilege_Failure then if Child /= 0 then Put_Line ("**** Child failed due to insufficient privilege"); else Put_Line ("**** Failed some parts due to insufficient privilege"); end if; end if; if Error_Count > 0 and Child = 0 then Put ("==== Failed"); Put (Natural'Image (Error_Count)); Put (" test"); if Error_Count /= 1 then Put ("s."); end if; New_Line; end if; end if; for I in Nonsupport'Range loop if Nonsupport (I) then Put ("**** Nonsupport of "&POSIX_Option'Image (I)&" detected."); New_Line; end if; end loop; Flush; if Child /= 0 then -- Report number of errors back to parent process. if Error_Count >= Natural (Failed_Creation_Exit) then Put ("==== Child error count overflowed"); Error_Count := Natural (Failed_Creation_Exit) - 1; end if; Exit_Process (Exit_Status (Error_Count)); end if; end Done; procedure Fatal (Msg : String) is begin Fail ("fatal error: [" & Msg & "]"); Done; Exit_Process (Normal_Exit); end Fatal; procedure Fatal_Exception (E : Ada.Exceptions.Exception_Occurrence; Message : String) is begin if Message /= "" then Fail ("[" & Message & "] fatal exception " & Exception_Name (E)); else Fail ("fatal exception " & Exception_Name (E)); end if; Done; Exit_Process (Normal_Exit); end Fatal_Exception; procedure Pass_Through_Verbosity (Args : in out POSIX.POSIX_String_List) is begin if Verbose then Append (Args, "-v"); elsif Terse then Append (Args, "-t"); end if; end Pass_Through_Verbosity; procedure Check_Child_Status (Status : Termination_Status; Child_ID : Process_ID; Expected : Exit_Status; Message : String) is E : Exit_Status; begin Assert (Child_ID /= Null_Process_ID, Message & ": null child id"); if not Status_Available (Status) then -- Fail when status not available Fail (Message & ": no status available"); return; end if; Assert (Process_ID_Of (Status) = Child_ID, Message & ": wrong child"); if Termination_Cause_Of (Status) /= Exited then -- Fail when did not exit Assert (False, Message & ": did not exit"); return; end if; E := Exit_Status_Of (Status); if E > 0 and E < Failed_Creation_Exit then -- child process reports errors via exit status Increment_Error_Count (Integer (E)); elsif E /= Expected then Assert (False, Message & ": exit status =" & Exit_Status'Image (E)); end if; declare Sig : Signal; begin Sig := Stopping_Signal_Of (Status); -- Stopping_Signal_Of invalid status Expect_Exception (Message); exception when POSIX_Error => Check_Error_Code (Invalid_Argument, Message); when E : others => Fail (E, Message); end; declare Sig : Signal; begin Sig := Termination_Signal_Of (Status); -- Termination_Signal_Of invalid status Expect_Exception (Message); exception when POSIX_Error => Check_Error_Code (Invalid_Argument, Message); when E : others => Fail (E, Message); end; exception when E : others => Unexpected_Exception (E, Message); end Check_Child_Status; begin for I in 1 .. Argument_Count loop if Argument (I) = "-v" then Verbose := True; elsif Argument (I) = "-t" then Terse := True; elsif Argument (I)'Length >= 6 and then Argument (I)(Argument (I)'First .. Argument (I)'First + 5) = "-child" then -- Treat this argument as value of Child. -- Default value is 1. declare Arg : constant String := Argument (I); J : Integer := Arg'First + 6; Tmp : Integer := 0; begin while J <= Arg'Last and then Arg (J) = ' ' loop J := J + 1; end loop; while J <= Arg'Last and then Arg (J) in '0' .. '9' loop Tmp := Tmp * 10 + Character'Pos (Arg (J)) - Character'Pos ('0'); J := J + 1; end loop; while J <= Arg'Last and then Arg (J) = ' ' loop J := J + 1; end loop; if J /= Arg'Last + 1 or Tmp = 0 then Child := 1; else Child := Tmp; end if; exception when others => Fail ("bad command-line argument"); end; end if; end loop; end POSIX_Report; florist-gpl-2017-src/gnatsocks/sockets.ads0000644000076700001450000001743113106553473020164 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- GNATSOCKS -- -- -- -- S o c k e t s -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1997-1998 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- This file is a component of GNATSOCKS, an Ada interfaces to socket I/O -- -- services, for use with the GNAT Ada compiler. -- -- -- -- GNATSOCKS is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- [$Revision: 254317 $] ------------------------------------------------------------------------ -- This package is intended to provide convenient access to socket I/O. -- It still needs design, documentation, and implementation work. -- For example, there is no specification what happens if an error occurs -- for each of the operations. with Ada.Finalization, Ada.Streams, Ada.Tags, POSIX, POSIX.C; package Sockets is -------------------------------------- type Socket_Address is abstract tagged private; -------------------------------------- type Socket is abstract tagged limited private; procedure Close (Sock : in out Socket'Class); -- closes the socket function Get_Address (cock : in Socket'Class) return Socket_Address is abstract; -- gets address of socket -------------------------------------- type Input_Stream is new Ada.Streams.Root_Stream_Type with private; type Input_Stream_Ptr is access all Input_Stream; type Output_Stream is new Ada.Streams.Root_Stream_Type with private; type Output_Stream_Ptr is access all Output_Stream; -------------------------------------- type Stream_Socket is new Socket with private; procedure Open (Sock : in out Stream_Socket; Addr : Socket_Address'Class); -- creates a stream socket and connects it to the specified address function Get_Input_Stream (Sock : Stream_Socket) return Input_Stream_Ptr; function Get_Output_Stream (Sock : Stream_Socket) return Output_Stream_Ptr; -------------------------------------- type Server_Socket is new Socket with private; procedure Open (Sock : in out Server_Socket; Addr : Socket_Address'Class; Count : Natural := 0); -- creates a server socket on the specified port -- with the specified backlog count procedure Accept_Connection (Server : Server_Socket; Stream : in out Stream_Socket'Class; Peer : in out Socket_Address'Class); -- accept connection addressed to Server socket, and -- open Stream socket to handle the connection. -------------------------------------- -- This part is "in progress". type Datagram_Socket is new Socket with private; -- connectionless procedure Open (Sock : in out Datagram_Socket; Addr : in Socket_Address'Class); -- creates a datagram socket on the specified port -- with the specified local address procedure Send (Sock : in Datagram_Socket; Addr : in Socket_Address'Class; Data : in String); -- sends Data to the specified address Addr procedure Receive (Sock : in Datagram_Socket; Addr : out Socket_Address'Class; Buff : in out String; Last : out Natural); -- receives data into Buff -- Last is the index of the last position in Buff that is used. -- Addr receives the sender's address. private function Address (Addr : Socket_Address) return POSIX.C.Sockets.sockaddr_ptr is abstract; function Length (Addr : Socket_Address) return POSIX.C.int is abstract; function Valid (Addr : Socket_Address) return Boolean is abstract; function Protocol_Family (Addr : Socket_Address) return POSIX.C.int is abstract; type Socket_Address is abstract tagged null record; ----------------------------------- type Socket is new Ada.Finalization.Limited_Controlled with record fd : POSIX.C.int := 0; -- file descriptor of an open socket, of nonzero tag : Ada.Tags.Tag; -- tag of the socket address type used to open the socket, of fd /= 0 -- This is used to check that other operations use only addresses -- that are in the same family. end record; procedure Finalize (Sock : in out Socket); ----------------------------------- type Stream_Socket_Ptr is access all Stream_Socket; type Input_Stream is new Ada.Streams.Root_Stream_Type with record sock : Stream_Socket_Ptr; end record; type Output_Stream is new Ada.Streams.Root_Stream_Type with record sock : Stream_Socket_Ptr; end record; type Stream_Socket is new Socket with record in_stream : aliased Input_Stream; out_stream : aliased Output_Stream; in_ptr : Input_Stream_Ptr; -- points to in_stream out_ptr : Output_Stream_Ptr; -- points to out_stream -- These pointers are needed to implement -- functions Get_InputStream and Get_OutputStream. end record; procedure Read (Stream : in out Input_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset); procedure Write (Stream : in out Input_Stream; Item : in Ada.Streams.Stream_Element_Array); procedure Read (Stream : in out Output_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset); procedure Write (Stream : in out Output_Stream; Item : in Ada.Streams.Stream_Element_Array); ----------------------------------- type Server_Socket is new Socket with null record; ----------------------------------- type Datagram_Socket is new Socket with null record; end Sockets; florist-gpl-2017-src/gnatsocks/echoserver.adb0000644000076700001450000000423613106553473020634 0ustar gnatmailgnat-------------------------------------------------------------------------- -- file : echoserver.adb [$Revision: 110555 $] -------------------------------------------------------------------------- -- This is a direct translation into GNAT Ada -- of the Java example in file "echoserver.java". -- waits for a client to attach to port 8189, then -- reads input from the client, a line at a time, and echos it. -- To run this program, type "java EchoServer", then put the job in -- the background or switch to another window and type -- "telnet 8189", replacing by the name of -- the host on which you are running the echo-server. -- This will connect you to the server. with ada.characters.latin_1; with ada.exceptions; with ada.text_io; with sockets; with sockets.internet; procedure echoserver is s : sockets.server_socket; connection : sockets.stream_socket; ins : sockets.input_stream_ptr; outs : sockets.output_stream_ptr; peer : sockets.internet.internet_socket_address; lf : constant character := ada.characters.latin_1.lf; -- line-feed cr : constant character := ada.characters.latin_1.cr; -- carriage-return procedure writeln (s : string) is begin string'write (outs, s); character'write (outs, cr); character'write (outs, lf); end writeln; function readln return string is buf : string (1 .. 1024); i : integer := 1; begin loop character'read (ins, buf (i)); exit when buf (i) = lf; i := i + 1; end loop; return buf (1 .. i-2); end readln; begin sockets.open (s, sockets.internet.new_address (8189, "dad.cs.fsu.edu")); sockets.accept_connection (s, connection, peer); ins := sockets.get_input_stream (connection); outs := sockets.get_output_stream (connection); writeln ("Hello! Enter BYE to exit."); loop declare str : string := readln; begin exit when str (1..3) = "BYE"; writeln ("Echo: """ & str & '"'); end; end loop; exception when e : others => ada.text_io.put_line (ada.exceptions.exception_name (e) & ": " & ada.exceptions.exception_message (e)); end echoserver; florist-gpl-2017-src/gnatsocks/sockets-internet.adb0000644000076700001450000003111413106553473021763 0ustar gnatmailgnat------------------------------------------------------------------------------ -- -- -- GNATSOCKS -- -- -- -- S o c k e t s . I n t e r n e t -- -- -- -- B o d y -- -- -- -- -- -- Copyright (c) 1997-1998 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- This file is a component of GNATSOCKS, an Ada interfaces to socket I/O -- -- services, for use with the GNAT Ada compiler. -- -- -- -- GNATSOCKS is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. FLORIST is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ -- [$Revision: 110555 $] with Ada.Streams, POSIX, POSIX.C, POSIX.Implementation, System, Unchecked_Conversion; package body Sockets.Internet is use POSIX, POSIX.C, POSIX.C.NetDB, POSIX.C.Netinet, POSIX.C.Sockets, POSIX.Implementation; Local_Hostname : String (1 .. 256) := (others => Character'Val (0)); function inet_addr (cp : char_var_ptr) return unsigned_long; pragma Import (C, inet_addr, inet_addr_LINKNAME); function inet_network (cp : char_var_ptr) return unsigned_long; pragma Import (C, inet_network, inet_network_LINKNAME); function inet_makeaddr (net, lna : int) return struct_in_addr; pragma Import (C, inet_makeaddr, inet_makeaddr_LINKNAME); function inet_lnaof (addr : struct_in_addr) return int; pragma Import (C, inet_lnaof, inet_lnaof_LINKNAME); function inet_netof (addr : struct_in_addr) return int; pragma Import (C, inet_netof, inet_netof_LINKNAME); function inet_ntoa (addr : struct_in_addr) return char_ptr; pragma Import (C, inet_ntoa, inet_ntoa_LINKNAME); function gethostbyname_r (name : char_ptr; result : hostent_var_ptr; buffer : char_var_ptr; buflen : int; errnop : access int) return hostent_ptr; pragma Import (C, gethostbyname_r, gethostbyname_r_LINKNAME); function gethostbyaddr_r (addr : char_ptr; length : int; addr_type : int; result : hostent_var_ptr; buffer : char_var_ptr; buflen : int; errnop : access int) return hostent_ptr; pragma Import (C, gethostbyaddr_r, gethostbyaddr_r_LINKNAME); function htonl (hostlong : unsigned_long) return unsigned_long; pragma Import (C, htonl, "c_htonl"); function ntohl (netlong : unsigned_long) return unsigned_long; pragma Import (C, ntohl, "c_ntohl"); function htons (hostshort : unsigned_short) return unsigned_short; pragma Import (C, htons, "c_htons"); function ntohs (netshort : unsigned_short) return unsigned_short; pragma Import (C, ntohs, "c_ntohs"); function gethostname (name : char_var_ptr; namelen : int) return int; pragma Import (C, gethostname, gethostname_LINKNAME); function read (fildes : int; buf : char_var_ptr; nbyte : size_t) return ssize_t; pragma Import (C, read, read_LINKNAME); function write (fildes : int; buf : char_ptr; nbyte : size_t) return ssize_t; pragma Import (C, write, write_LINKNAME); function open (path : char_ptr; oflag : int; mode : mode_t := 0) return int; pragma Import (C, open, open_LINKNAME); function close (fd : int) return int; pragma Import (C, close, close_LINKNAME); -- close a file descriptor (or socket) function unlink (path : char_ptr) return int; pragma Import (C, unlink, unlink_LINKNAME); function link (existing : char_ptr; new_name : char_ptr) return int; pragma Import (C, link, link_LINKNAME); function fsync (fildes : int) return int; pragma Import (C, fsync, fsync_LINKNAME); function stat (path : char_ptr; buf : stat_ptr) return int; pragma Import (C, stat, stat_LINKNAME); function Get_AddressString (Addr : Internet_Address) return String is begin return Form_String (inet_ntoa (Addr.C)); end Get_AddressString; function Hash_Code (Addr : Internet_Address) return Integer is begin return Integer (Addr.C.s_addr mod 2**(Integer'Size - 1)); end Hash_Code; function "=" (Left, Right : Internet_Address) return Boolean is begin return Left.C.s_addr = Right.C.s_addr; end "="; function cptr_to_sia is new Unchecked_Conversion (char_ptr, in_addr_ptr); function Get_AddrByName (Host : String) return Internet_Address is name : constant POSIX_String := To_POSIX_String (Host) & NUL; hostent : aliased struct_hostent; buffer : POSIX_String (1 .. 1024); error_code : aliased int; p : hostent_ptr; begin p := gethostbyname_r (name => name (name'First)'Unchecked_Access, result => hostent'Unchecked_Access, buffer => buffer (buffer'First)'Unchecked_Access, buflen => buffer'Length, errnop => error_code'Unchecked_Access); if p = null then Raise_POSIX_Error; end if; return (C => cptr_to_sia (p.h_addr_list.all).all); end Get_AddrByName; function Get_HostByAddr (Addr : Internet_Address) return String is hostent : aliased struct_hostent; buffer : POSIX_String (1 .. 1024); error_code : aliased int; p : hostent_ptr; function "+" is new Unchecked_Conversion (in_addr_ptr, char_ptr); begin p := gethostbyaddr_r (addr => +Addr.C'Unchecked_Access, length => Addr.C'Size / char'Size, addr_type => AF_INET, result => hostent'Unchecked_Access, buffer => buffer (buffer'First)'Unchecked_Access, buflen => buffer'Length, errnop => error_code'Unchecked_Access); if p = null then Raise_POSIX_Error; end if; return Form_String (p.h_name); end Get_HostByAddr; function Local_Host return Internet_Address is function "+" is new Unchecked_Conversion (System.Address, char_var_ptr); begin if Local_Hostname (Local_Hostname'First) = Character'Val (0) then Check (gethostname (+Local_Hostname (Local_Hostname'First)'Address, Local_Hostname'Length)); end if; return Get_AddrByName (Local_Hostname); end Local_Host; -------------------------------------- function Get_AllByName (Host : String) return Internet_Address_Array is name : constant POSIX_String := To_POSIX_String (Host) & NUL; hostent : aliased struct_hostent; buffer : POSIX_String (1 .. 1024); error_code : aliased int; p : hostent_ptr; q : char_ptr_ptr; len : integer := 0; begin p := gethostbyname_r (name => name (name'First)'Unchecked_Access, result => hostent'Unchecked_Access, buffer => buffer (buffer'First)'Unchecked_Access, buflen => buffer'Length, errnop => error_code'Unchecked_Access); if p = null then Raise_POSIX_Error; end if; q := hostent.h_addr_list; while q.all /= null loop len := len + 1; Advance (q); end loop; declare result : Internet_Address_Array (1 .. len); begin q := hostent.h_addr_list; for I in result'Range loop result (I) := (C => cptr_to_sia (q.all).all); Advance (q); end loop; return result; end; end Get_AllByName; -------------------------------------- function getsockname (socket_fd : int; name : struct_sockaddr_var_ptr; namelen : access int) return int; pragma Import (C, getsockname, getsockname_LINKNAME); -- returns the current name for a socket function Get_Address (Sock : in Socket'Class) return Internet_Socket_Address is addr : aliased struct_sockaddr_in; addrlen : aliased int := addr'Size / char'Size; function "+" is new Unchecked_Conversion (sockaddr_in_var_ptr, sockaddr_var_ptr); begin Check (getsockname (Sock.fd, +addr'Unchecked_Access, addrlen'Unchecked_Access)); if addrlen /= addr'Size / char'Size then raise Constraint_Error; end if; return (Socket_Address with in_addr => addr); end Get_Address; function New_Address (Port : Port_Number; Addr : Internet_Address := Local_Host) return Internet_Socket_Address is begin return (Socket_Address with in_addr => (sin_family => AF_INET, sin_port => in_port_t (htons (unsigned_short (Port))), sin_addr => Addr.C, sin_zero => (others => NUL))); end New_Address; function New_Address (Port : Port_Number; Host : String) return Internet_Socket_Address is begin return New_Address (Port, Get_AddrByName (Host)); end New_Address; function Get_Internet_Address (Addr : Internet_Socket_Address) return Internet_Address is begin return (C => Addr.in_addr.sin_addr); end Get_Internet_Address; function Get_Port (Addr : Internet_Socket_Address) return Port_Number is begin return Port_Number (Addr.in_addr.sin_port); end Get_Port; ---------------------------------------- function getpeername (socket_fd : int; name : access struct_sockaddr; namelen : access int) return int; pragma Import (C, getpeername, getpeername_LINKNAME); -- returns the name of the peer connected to a socket function Get_PeerAddress (Sock : Stream_Socket) return Internet_Socket_Address is addr : aliased struct_sockaddr_in; addrlen : aliased int := addr'Size / char'Size; function "+" is new Unchecked_Conversion (sockaddr_in_var_ptr, sockaddr_var_ptr); begin Check (getpeername (Sock.fd, +addr'Unchecked_Access, addrlen'Unchecked_Access)); if addrlen /= addr'Size / char'Size then raise Constraint_Error; end if; return (Socket_Address with in_addr => addr); end Get_PeerAddress; ---------------------------------------- function Address (Addr : Internet_Socket_Address) return sockaddr_ptr is function "+" is new Unchecked_Conversion (sockaddr_in_ptr, sockaddr_ptr); begin return +Addr.in_addr'Unchecked_Access; end Address; function Length (Addr : Internet_Socket_Address) return POSIX.C.int is begin return Addr.in_addr'Size / char'Size; end Length; function Valid (Addr : Internet_Socket_Address) return Boolean is -- This is only the most basic validity check. -- ???? Consider doing more? begin return Addr.in_addr.sin_family = AF_INET; end Valid; function Protocol_Family (Addr : Internet_Socket_Address) return POSIX.C.int is begin return PF_INET; end Protocol_Family; end Sockets.Internet; florist-gpl-2017-src/lynxos5/0000755000076700001450000000000013106553470015434 5ustar gnatmailgnatflorist-gpl-2017-src/lynxos5/posix-limits.ads0000644000076700001450000001721513106553473020577 0ustar gnatmailgnat-- DO NOT EDIT THIS FILE. -- It is generated automatically, by program c-posix.c ------------------------------------------------------------------------------ -- -- -- POSIX Ada95 Bindings for Protocol Independent Interfaces (P1003.5c) -- -- -- -- P O S I X . L I M I T S -- -- -- -- S p e c -- -- -- -- -- -- -- -- This file is a component of FLORIST, an Ada application program -- -- interface for operating system services for use with the GNAT compiler -- -- and the Gnu Ada Runtime Library (GNARL). FLORIST is intended to -- -- conform to the IEEE POSIX Ada standards, 1003.5-1992 and 1003.5b-1993. -- -- It also includes support for Draft 1 of IEEE Project 1003.5c. -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ package POSIX.Limits is ------------------------------ -- Portable System Limits -- ------------------------------ -- .... Change P1003.5b? -- to allow these constants -- to be larger than the minimum values specified. Portable_Argument_List_Maximum : Natural renames POSIX.Portable_Argument_List_Maximum; Portable_Asynchronous_IO_Maximum : constant Natural := 1; Portable_Child_Processes_Maximum : Natural renames POSIX.Portable_Child_Processes_Maximum; Portable_Clock_Resolution_Minimum : constant := 20_000_000; Portable_Filename_Maximum : Natural renames POSIX.Portable_Filename_Limit_Maximum; Portable_Groups_Maximum : Natural renames POSIX.Portable_Groups_Maximum; Portable_Input_Line_Maximum : POSIX.IO_Count renames POSIX.Portable_Input_Line_Limit_Maximum; Portable_Input_Queue_Maximum : POSIX.IO_Count renames POSIX.Portable_Input_Queue_Limit_Maximum; Portable_Links_Maximum : Natural renames POSIX.Portable_Link_Limit_Maximum; Portable_List_IO_Maximum : constant Natural := 2; Portable_Message_Priority_Maximum : constant Natural := 32; Portable_Open_Files_Maximum : Natural renames POSIX.Portable_Open_Files_Maximum; Portable_Open_Message_Queues_Maximum : constant Natural := 8; Portable_Pathname_Maximum : Natural renames POSIX.Portable_Pathname_Limit_Maximum; Portable_Pipe_Length_Maximum : POSIX.IO_Count renames POSIX.Portable_Pipe_Limit_Maximum; Portable_Queued_Signals_Maximum : constant Natural := 32; Portable_Realtime_Signals_Maximum : constant Natural := 8; Portable_Semaphores_Maximum : constant Natural := 256; Portable_Semaphores_Value_Maximum : constant Natural := 32767; Portable_Streams_Maximum : Natural renames POSIX.Portable_Stream_Maximum; Portable_Timer_Overruns_Maximum : constant Natural := 32; Portable_Timers_Maximum : constant Natural := 32; Portable_Time_Zone_String_Maximum : Natural renames POSIX.Portable_Time_Zone_String_Maximum; -- limits from POSIX.5c [D2] Portable_File_Descriptor_Set_Maximum : Natural renames POSIX.Portable_Open_Files_Maximum; Portable_Socket_Buffer_Maximum : POSIX.IO_Count renames POSIX.Portable_Pipe_Limit_Maximum; Portable_Socket_IO_Vector_Maximum : constant Natural := 16; Portable_Socket_Connection_Maximum : constant Natural := 1; Portable_XTI_IO_Vector_Maximum : constant Natural := 16; --------------------------- -- Configurable Limits -- --------------------------- subtype Argument_List_Maxima is POSIX.Argument_List_Maxima; subtype Asynchronous_IO_Maxima is Natural range 1 .. Natural'Last; subtype Asynchronous_IO_Priority_Delta_Maxima is Natural range 255 .. 255; subtype Child_Processes_Maxima is POSIX.Child_Processes_Maxima; subtype Filename_Maxima is POSIX.Filename_Limit_Maxima; subtype Groups_Maxima is POSIX.Groups_Maxima; subtype Input_Line_Maxima is POSIX.Input_Line_Limit_Maxima; subtype Input_Queue_Maxima is POSIX.Input_Queue_Limit_Maxima; subtype Links_Maxima is POSIX.Link_Limit_Maxima; subtype List_IO_Maxima is Natural range 2 .. Natural'Last; subtype Message_Priority_Maxima is Natural range 255 .. 255; subtype Open_Message_Queues_Maxima is Natural range 8 .. Natural'Last; subtype Open_Files_Maxima is POSIX.Open_Files_Maxima; subtype Page_Size_Range is Natural range 4096 .. 4096; subtype Pathname_Maxima is POSIX.Pathname_Limit_Maxima; subtype Pipe_Length_Maxima is POSIX.Pipe_Limit_Maxima; subtype Queued_Signals_Maxima is Natural range 256 .. 256; subtype Realtime_Signals_Maxima is Natural range 32 .. 32; subtype Semaphores_Maxima is Natural range 256 .. Natural'Last; subtype Semaphores_Value_Maxima is Natural range 2147483647 .. 2147483647; subtype Streams_Maxima is POSIX.Stream_Maxima; subtype Timer_Overruns_Maxima is Natural range 2147483647 .. 2147483647; subtype Timers_Maxima is Natural range 32 .. Natural'Last; subtype Time_Zone_String_Maxima is POSIX.Time_Zone_String_Maxima; -- limits from POSIX.5c [D2] subtype File_Descriptor_Set_Maxima is Natural range 256 .. 256; subtype Socket_Buffer_Maxima is IO_Count range 512 .. IO_Count'Last; subtype Socket_IO_Vector_Maxima is Natural range 16 .. Natural'Last; subtype Socket_Connection_Maxima is Natural range 1 .. Natural'Last; subtype XTI_IO_Vector_Maxima is Natural range 16 .. Natural'Last; end POSIX.Limits; florist-gpl-2017-src/lynxos5/posix.ads0000644000076700001450000005771113106553473017305 0ustar gnatmailgnat-- DO NOT EDIT THIS FILE. -- It is generated automatically, by program c-posix.c ------------------------------------------------------------------------------ -- -- -- POSIX Ada95 Bindings for Protocol Independent Interfaces (P1003.5c) -- -- -- -- P O S I X -- -- -- -- S p e c -- -- -- -- -- -- -- -- This file is a component of FLORIST, an Ada application program -- -- interface for operating system services for use with the GNAT compiler -- -- and the Gnu Ada Runtime Library (GNARL). FLORIST is intended to -- -- conform to the IEEE POSIX Ada standards, 1003.5-1992 and 1003.5b-1993. -- -- It also includes support for Draft 1 of IEEE Project 1003.5c. -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ with Ada_Streams; with Interfaces; package POSIX is -- 2.4.1 Constants and Static Subtypes -- Version Identification POSIX_Version : constant := 1995_06; POSIX_Ada_Version : constant := 1995_00; -- Optional Facilities (obsolescent, 0) -- See package POSIX.Limits for preferred interfaces. subtype Job_Control_Support is Boolean range True .. True; subtype Saved_IDs_Support is Boolean range True .. True; subtype Change_Owner_Restriction is Boolean range True .. True; subtype Filename_Truncation is Boolean range True .. True; -- Bytes and I/O Counts Byte_Size : constant := 8; type IO_Count is range -2**31 .. (2**31)-1; for IO_Count'Size use 32; subtype IO_Count_Maxima is IO_Count range 32767 .. IO_Count'Last; -- System Limits (obsolescent) -- See package POSIX.Limits for preferred interfaces. Portable_Groups_Maximum : constant Natural := 0; subtype Groups_Maxima is Natural range 8 .. Natural'Last; Portable_Argument_List_Maximum : constant Natural := 4096; subtype Argument_List_Maxima is Natural range 4096 .. Natural'Last; Portable_Child_Processes_Maximum : constant Natural := 6; subtype Child_Processes_Maxima is Natural range 25 .. Natural'Last; Portable_Open_Files_Maximum : constant Natural := 16; subtype Open_Files_Maxima is Natural range 20 .. Natural'Last; Portable_Stream_Maximum : constant Natural := 8; subtype Stream_Maxima is Natural range 8 .. Natural'Last; Portable_Time_Zone_String_Maximum : constant Natural := 3; subtype Time_Zone_String_Maxima is Natural range 10 .. 10; -- Pathname Variable Values (obsolescent) -- See package POSIX.Limits for preferred interfaces. Portable_Link_Limit_Maximum : constant Natural := 8; subtype Link_Limit_Maxima is Natural range 32767 .. 32767; Portable_Input_Line_Limit_Maximum : constant IO_Count := 255; subtype Input_Line_Limit_Maxima is IO_Count range 512 .. 512; Portable_Input_Queue_Limit_Maximum : constant IO_Count := 255; subtype Input_Queue_Limit_Maxima is IO_Count range 256 .. 256; Portable_Filename_Limit_Maximum : constant Natural := 14; subtype Filename_Limit_Maxima is Natural range 255 .. 255; Portable_Pathname_Limit_Maximum : constant Natural := 255; subtype Pathname_Limit_Maxima is Natural range 1024 .. 1024; Portable_Pipe_Limit_Maximum : constant IO_Count := 512; subtype Pipe_Limit_Maxima is IO_Count range 512 .. 512; -- Blocking Behavior Values type Blocking_Behavior is (Tasks, Program, Special); subtype Text_IO_Blocking_Behavior is Blocking_Behavior range Tasks .. Tasks; IO_Blocking_Behavior : constant Blocking_Behavior := Tasks; File_Lock_Blocking_Behavior : constant Blocking_Behavior := Tasks; Wait_For_Child_Blocking_Behavior : constant Blocking_Behavior := Tasks; subtype Realtime_Blocking_Behavior is Blocking_Behavior range Tasks .. Program; -- Signal Masking type Signal_Masking is (No_Signals, RTS_Signals, All_Signals); -- Characters and Strings type POSIX_Character is new Standard.Character; -- We rely here on the fact that the GNAT type Character -- is the same as the GCC type char in C, -- which in turn must be the same as POSIX_Character. NUL : constant POSIX_Character := POSIX_Character (ASCII.NUL); SOH : constant POSIX_Character := POSIX_Character (ASCII.SOH); STX : constant POSIX_Character := POSIX_Character (ASCII.STX); ETX : constant POSIX_Character := POSIX_Character (ASCII.ETX); EOT : constant POSIX_Character := POSIX_Character (ASCII.EOT); ENQ : constant POSIX_Character := POSIX_Character (ASCII.ENQ); ACK : constant POSIX_Character := POSIX_Character (ASCII.ACK); BEL : constant POSIX_Character := POSIX_Character (ASCII.BEL); BS : constant POSIX_Character := POSIX_Character (ASCII.BS); HT : constant POSIX_Character := POSIX_Character (ASCII.HT); LF : constant POSIX_Character := POSIX_Character (ASCII.LF); VT : constant POSIX_Character := POSIX_Character (ASCII.VT); FF : constant POSIX_Character := POSIX_Character (ASCII.FF); CR : constant POSIX_Character := POSIX_Character (ASCII.CR); SO : constant POSIX_Character := POSIX_Character (ASCII.SO); SI : constant POSIX_Character := POSIX_Character (ASCII.SI); DLE : constant POSIX_Character := POSIX_Character (ASCII.DLE); DC1 : constant POSIX_Character := POSIX_Character (ASCII.DC1); DC2 : constant POSIX_Character := POSIX_Character (ASCII.DC2); DC3 : constant POSIX_Character := POSIX_Character (ASCII.DC3); DC4 : constant POSIX_Character := POSIX_Character (ASCII.DC4); NAK : constant POSIX_Character := POSIX_Character (ASCII.NAK); SYN : constant POSIX_Character := POSIX_Character (ASCII.SYN); ETB : constant POSIX_Character := POSIX_Character (ASCII.ETB); CAN : constant POSIX_Character := POSIX_Character (ASCII.CAN); EM : constant POSIX_Character := POSIX_Character (ASCII.EM); SUB : constant POSIX_Character := POSIX_Character (ASCII.SUB); ESC : constant POSIX_Character := POSIX_Character (ASCII.ESC); FS : constant POSIX_Character := POSIX_Character (ASCII.FS); GS : constant POSIX_Character := POSIX_Character (ASCII.GS); RS : constant POSIX_Character := POSIX_Character (ASCII.RS); US : constant POSIX_Character := POSIX_Character (ASCII.US); type POSIX_String is array (Positive range <>) of aliased POSIX_Character; function To_POSIX_String (Str : String) return POSIX_String; function To_POSIX_String (Str : Wide_String) return POSIX_String; function To_String (Str : POSIX_String) return String; function To_Wide_String (Str : POSIX_String) return Wide_String; function To_Stream_Element_Array (Buffer : POSIX_String) return Ada_Streams.Stream_Element_Array; function To_POSIX_String (Buffer : Ada_Streams.Stream_Element_Array) return POSIX_String; subtype Filename is POSIX_String; subtype Pathname is POSIX_String; function Is_Filename (Str : POSIX_String) return Boolean; function Is_Pathname (Str : POSIX_String) return Boolean; function Is_Portable_Filename (Str : POSIX_String) return Boolean; function Is_Portable_Pathname (Str : POSIX_String) return Boolean; -- String Lists type POSIX_String_List is limited private; Empty_String_List : constant POSIX_String_List; procedure Make_Empty (List : in out POSIX_String_List); procedure Append (List : in out POSIX_String_List; Str : in POSIX_String); generic with procedure Action (Item : in POSIX_String; Quit : in out Boolean); procedure For_Every_Item (List : in POSIX_String_List); function Length (List : POSIX_String_List) return Natural; function Value (List : POSIX_String_List; Index : Positive) return POSIX_String; -- option sets type Option_Set is private; function Empty_Set return Option_Set; function "+" (L, R : Option_Set) return Option_Set; function "-" (L, R : Option_Set) return Option_Set; function "<" (Left, Right : Option_Set) return Boolean; function "<="(Left, Right : Option_Set) return Boolean; function ">" (Left, Right : Option_Set) return Boolean; function ">="(Left, Right : Option_Set) return Boolean; Option_1 : constant Option_Set; Option_2 : constant Option_Set; Option_3 : constant Option_Set; Option_4 : constant Option_Set; Option_5 : constant Option_Set; Option_6 : constant Option_Set; Option_7 : constant Option_Set; Option_8 : constant Option_Set; Option_9 : constant Option_Set; Option_10 : constant Option_Set; Option_11 : constant Option_Set; Option_12 : constant Option_Set; Option_13 : constant Option_Set; Option_14 : constant Option_Set; Option_15 : constant Option_Set; Option_16 : constant Option_Set; Option_17 : constant Option_Set; Option_18 : constant Option_Set; Option_19 : constant Option_Set; Option_20 : constant Option_Set; Option_21 : constant Option_Set; Option_22 : constant Option_Set; Option_23 : constant Option_Set; Option_24 : constant Option_Set; Option_25 : constant Option_Set; Option_26 : constant Option_Set; Option_27 : constant Option_Set; Option_28 : constant Option_Set; Option_29 : constant Option_Set; Option_30 : constant Option_Set; Option_31 : constant Option_Set; -- Exceptions and error codes POSIX_Error : exception; type Error_Code is range -2**31 .. (2**31)-1; for Error_Code'Size use 32; function Get_Error_Code return Error_Code; procedure Set_Error_Code (Error : in Error_Code); function Is_POSIX_Error (Error : Error_Code) return Boolean; function Image (Error : Error_Code) return String; No_Error : constant Error_Code := 0; -- Error code constants with negative values correspond to -- error codes that are not supported by the current system. -- error codes E2BIG, Argument_List_Too_Long : constant := 7; EACCES, Permission_Denied : constant := 13; EADDRINUSE, Address_In_Use : constant := 48; EADDRNOTAVAIL, Address_Not_Available : constant := 49; EAFNOSUPPORT, Inappropriate_Family : constant := 47; EAGAIN, Resource_Temporarily_Unavailable : constant := 11; EALREADY, Already_Awaiting_Connection : constant := 37; EBADF, Bad_File_Descriptor : constant := 9; ENOTSUP, Operation_Not_Supported : constant := 77; EBUSY, Resource_Busy : constant := 16; ECANCELED, Operation_Canceled : constant := 69; ECHILD, No_Child_Process : constant := 10; ECONNABORTED, Connection_Aborted : constant := 53; ECONNREFUSED, Connection_Refused : constant := 61; ECONNRESET, Connection_Reset : constant := 54; EDEADLK, Resource_Deadlock_Avoided : constant := 72; EDOM, Domain_Error : constant := 33; EEXIST, File_Exists : constant := 17; EFAULT, Bad_Address : constant := 14; EFBIG, File_Too_Large : constant := 27; EHOSTDOWN, Host_Down : constant := 64; EHOSTUNREACH, Host_Unreachable : constant := 65; EINPROGRESS, Operation_In_Progress : constant := 36; EINTR, Interrupted_Operation : constant := 4; EINVAL, Invalid_Argument : constant := 22; EIO, Input_Output_Error : constant := 5; EISCONN, Is_Already_Connected : constant := 56; EISDIR, Is_A_Directory : constant := 21; EMFILE, Too_Many_Open_Files : constant := 24; EMLINK, Too_Many_Links : constant := 31; EMSGSIZE, Message_Too_Long : constant := 40; ENAMETOOLONG, Filename_Too_Long : constant := 63; ENETDOWN, Network_Down : constant := 50; ENETRESET, Network_Reset : constant := 52; ENETUNREACH, Network_Unreachable : constant := 51; ENFILE, Too_Many_Open_Files_In_System : constant := 23; ENOBUFS, No_Buffer_Space : constant := 55; ENODEV, No_Such_Operation_On_Device : constant := 19; ENOENT, No_Such_File_Or_Directory : constant := 2; ENOPROTOOPT, Unknown_Protocol_Option : constant := 42; ENOEXEC, Exec_Format_Error : constant := 8; ENOLCK, No_Locks_Available : constant := 46; ENOMEM, Not_Enough_Space : constant := 12; ENOSPC, No_Space_Left_On_Device : constant := 28; ENOTCONN, Not_Connected : constant := 57; ENOTSOCK, Not_A_Socket : constant := 38; EBADMSG, Bad_Message : constant := 77; ENOTDIR, Not_A_Directory : constant := 20; ENOTEMPTY, Directory_Not_Empty : constant := 66; ENOSYS, Operation_Not_Implemented : constant := 99; ENOTTY, Inappropriate_IO_Control_Operation : constant := 25; ENXIO, No_Such_Device_Or_Address : constant := 6; EOPNOTSUPP, Option_Not_Supported : constant := 45; EPERM, Operation_Not_Permitted : constant := 1; EPIPE, Broken_Pipe : constant := 32; EPROTONOSUPPORT, Protocol_Not_Supported : constant := 43; EPROTOTYPE, Wrong_Protocol_Type : constant := 41; ERANGE, TBD2 : constant := 34; EROFS, Read_Only_File_System : constant := 30; ESOCKTNOSUPPORT, Socket_Not_Supported : constant := 44; ESPIPE, Invalid_Seek : constant := 29; ESRCH, No_Such_Process : constant := 3; ETIMEDOUT, Timed_Out : constant := 60; EWOULDBLOCK, Would_Block : constant := 11; EXDEV, Improper_Link : constant := 18; Host_Not_Found : constant := 1; NO_DATA, No_Address_Available : constant := 4; NO_RECOVERY, Unrecoverable_Error : constant := 3; EAI_ADDRFAMILY, Unknown_Address_Type : constant := 10001; EAI_AGAIN, Try_Again : constant := 10002; EAI_BADFLAGS, Invalid_Flags : constant := 10003; EAI_FAIL, Name_Failed : constant := 10004; EAI_FAMILY, Unknown_Protocol_Family : constant := 10005; EAI_MEMORY, Memory_Allocation_Failed : constant := 10006; EAI_NODATA, No_Address_For_Name : constant := 10007; EAI_NONAME, Name_Not_Known : constant := 10008; EAI_SERVICE, Service_Not_Supported : constant := 10009; EAI_SOCKTYPE, Unknown_Socket_Type : constant := 10010; subtype Addrinfo_Error_Code is Error_Code range 10000 .. 10010; TACCES, Insufficient_Permission : constant := 100003; -- *** MISSING: TADDRBUSY *** -- TADDRBUSY, XTI_Address_In_Use : constant := -1; TBADADDR, Incorrect_Address_Format : constant := 100001; TBADDATA, Illegal_Data_Range : constant := 100010; TBADF, Invalid_File_Descriptor : constant := 100004; TBADFLAG, Invalid_Flag : constant := 100016; -- *** MISSING: TBADNAME *** -- TBADNAME, Invalid_Communications_Provider : constant := -1; TBADOPT, Incorrect_Or_Illegal_Option : constant := 100002; -- *** MISSING: TBADQLEN *** -- TBADQLEN, Endpoint_Queue_Length_Is_Zero : constant := -1; TBADSEQ, Invalid_Sequence_Number : constant := 100007; TBUFOVFLW, Buffer_Not_Large_Enough : constant := 100011; TFLOW, Flow_Control_Error : constant := 100012; -- *** MISSING: TINDOUT *** -- TINDOUT, Outstanding_Connection_Indications : constant := -1; TLOOK, Event_Requires_Attention : constant := 100009; TNOADDR, Could_Not_Allocate_Address : constant := 100005; TNODATA, No_Data_Available : constant := 100013; TNODIS, No_Disconnect_Indication_On_Endpoint : constant := 100014; -- *** MISSING: TPROVMISMATCH *** -- TPROVMISMATCH, Communications_Provider_Mismatch : constant := -1; TNOREL, No_Orderly_Release_Indication_On_Endpoint : constant := 100017; -- *** MISSING: TNOSTRUCTYPE *** -- TNOSTRUCTYPE, Unsupported_Object_Type_Requested : constant := -1; TNOTSUPPORT, Function_Not_Supported : constant := 100018; TNOUDERR, No_Unitdata_Error_On_Endpoint : constant := 100015; TOUTSTATE, Function_Not_Valid_For_State : constant := 100006; -- *** MISSING: TPROTO *** -- TPROTO, Protocol_Error : constant := -1; -- *** MISSING: TQFULL *** -- TQFULL, Endpoint_Queue_Full : constant := -1; TSTATECHNG, State_Change_In_Progress : constant := 100019; -- *** MISSING: TRESADDR *** -- TRESADDR, Surrogate_File_Descriptor_Mismatch : constant := -1; -- *** MISSING: TRESQLEN *** -- TRESQLEN, Incorrect_Surrogate_Queue_Length : constant := -1; subtype XTI_Error_Code is Error_Code range 100000 .. 100019; -- System Identification function System_Name return POSIX_String; function Node_Name return POSIX_String; function Release return POSIX_String; function Version return POSIX_String; function Machine return POSIX_String; type Seconds is new Integer; type Minutes is new Integer; type Nanoseconds_Base is new Integer; subtype Nanoseconds is Nanoseconds_Base range 0 .. (10**9) - 1; type Timespec is private; function Get_Seconds (Time : Timespec) return Seconds; procedure Set_Seconds (Time : in out Timespec; S : in Seconds); function Get_Nanoseconds (Time : Timespec) return Nanoseconds; procedure Set_Nanoseconds (Time : in out Timespec; NS : in Nanoseconds); procedure Split (Time : in Timespec; S : out Seconds; NS : out Nanoseconds); function To_Timespec (S : Seconds; NS : Nanoseconds) return Timespec; function "+" (Left, Right : Timespec) return Timespec; function "+" (Left : Timespec; Right : Nanoseconds) return Timespec; function "-" (Right : Timespec) return Timespec; function "-" (Left, Right : Timespec) return Timespec; function "-" (Left : Timespec; Right : Nanoseconds) return Timespec; function "*" (Left : Timespec; Right : Integer) return Timespec; function "*" (Left : Integer; Right : Timespec) return Timespec; function "/" (Left : Timespec; Right : Integer) return Timespec; function "/" (Left, Right : Timespec) return Integer; function "<" (Left, Right : Timespec) return Boolean; function "<=" (Left, Right : Timespec) return Boolean; function ">" (Left, Right : Timespec) return Boolean; function ">=" (Left, Right : Timespec) return Boolean; function To_Duration (Time : Timespec) return Duration; -- pragma Inline (To_Duration); function To_Timespec (D : Duration) return Timespec; -- pragma Inline (To_Timespec); ------------------------------------------- -- Host-Network Byte Order Conversions -- ------------------------------------------- Host_Byte_Order_Is_Net_Byte_Order : Boolean := False; function Host_To_Network_Byte_Order (Host_32 : Interfaces.Unsigned_32) return Interfaces.Unsigned_32; function Host_To_Network_Byte_Order (Host_16 : Interfaces.Unsigned_16) return Interfaces.Unsigned_16; function Network_To_Host_Byte_Order (Host_32 : Interfaces.Unsigned_32) return Interfaces.Unsigned_32; function Network_To_Host_Byte_Order (Host_16 : Interfaces.Unsigned_16) return Interfaces.Unsigned_16; XTI_Blocking_Behavior : constant Blocking_Behavior := Tasks; Sockets_Blocking_Behavior : constant Blocking_Behavior := Tasks; -------------------------- -- Octet declarations -- -------------------------- type Octet is mod 2 ** 8; type Octet_Array is array (Integer range <>) of aliased Octet; type Octet_Array_Pointer is access all Octet_Array; private Florist_Version : constant String := "Florist-3.15p (20020604)"; type String_List; -- See package body for comments on String_List. type POSIX_String_List is access all String_List; Empty_String_List : constant POSIX_String_List := null; type Timespec is record Val : Duration := 0.0; end record; -- The value is of type Duration because we can do more -- efficient arithmetic on that type than on a two-part C struct. -- We rely that GNAT implements type Duration with enough -- precision (64 bits) to hold a full C timespec value. -- The enclosing record is to permit implicit initialization. type Bits is mod 2**32; for Bits'Size use 32; -- Bits and the C int type are always the same size. -- We don't define int here, since we want to be able to -- use it in the visible parts of child packages. type Option_Set is record Option : Bits := 0; end record; Option_1 : constant Option_Set := (Option => 2**0); Option_2 : constant Option_Set := (Option => 2**1); Option_3 : constant Option_Set := (Option => 2**2); Option_4 : constant Option_Set := (Option => 2**3); Option_5 : constant Option_Set := (Option => 2**4); Option_6 : constant Option_Set := (Option => 2**5); Option_7 : constant Option_Set := (Option => 2**6); Option_8 : constant Option_Set := (Option => 2**7); Option_9 : constant Option_Set := (Option => 2**8); Option_10 : constant Option_Set := (Option => 2**9); Option_11 : constant Option_Set := (Option => 2**10); Option_12 : constant Option_Set := (Option => 2**11); Option_13 : constant Option_Set := (Option => 2**12); Option_14 : constant Option_Set := (Option => 2**13); Option_15 : constant Option_Set := (Option => 2**14); Option_16 : constant Option_Set := (Option => 2**15); Option_17 : constant Option_Set := (Option => 2**16); Option_18 : constant Option_Set := (Option => 2**17); Option_19 : constant Option_Set := (Option => 2**18); Option_20 : constant Option_Set := (Option => 2**19); Option_21 : constant Option_Set := (Option => 2**20); Option_22 : constant Option_Set := (Option => 2**21); Option_23 : constant Option_Set := (Option => 2**22); Option_24 : constant Option_Set := (Option => 2**23); Option_25 : constant Option_Set := (Option => 2**24); Option_26 : constant Option_Set := (Option => 2**25); Option_27 : constant Option_Set := (Option => 2**26); Option_28 : constant Option_Set := (Option => 2**27); Option_29 : constant Option_Set := (Option => 2**28); Option_30 : constant Option_Set := (Option => 2**29); Option_31 : constant Option_Set := (Option => 2**30); end POSIX; florist-gpl-2017-src/lynxos5/posix-c.ads0000644000076700001450000031031413106553473017514 0ustar gnatmailgnat-- DO NOT EDIT THIS FILE. -- It is generated automatically, by program c-posix.c ------------------------------------------------------------------------------ -- -- -- FLORIST (FSU Implementation of POSIX.5) COMPONENTS -- -- -- -- P O S I X . C -- -- -- -- S p e c -- -- -- -- -- -- Copyright (c) 1996, 1997 Florida State University (FSU), -- -- All Rights Reserved. -- -- -- -- This file is a component of FLORIST, an Ada application program -- -- interface for operating system services for use with the GNAT compiler -- -- and the Gnu Ada Runtime Library (GNARL). FLORIST is intended to -- -- conform to the IEEE POSIX Ada standards, 1003.5-1992 and 1003.5b-1993. -- -- It also includes support for Draft 1 of IEEE Project 1003.5c. -- -- -- -- This is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. This software is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received a -- -- copy of the GNU General Public License distributed with GNARL; see -- -- file COPYING. If not, write to the Free Software Foundation, 59 -- -- Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with System; use System; with Unchecked_Conversion; package POSIX.C is pragma Elaborate_Body; -- ========= -- -- WARNING -- -- ========= -- -- This package should NOT be used directly by an application. -- It is internal to the FLORIST implementation of the POSIX.5 API, -- and may be changed or replaced in future versions of FLORIST. ALIGNMENT : constant := Natural'Min (Standard'Maximum_Alignment, 8); -- worst-case alignment requirement --------------------- -- basic C types -- --------------------- type short is range -2**15 .. (2**15)-1; for short'Size use 16; type int is range -2**31 .. (2**31)-1; for int'Size use 32; type int_ptr is access constant int; pragma Convention (C, int_ptr); type int_var_ptr is access all int; pragma Convention (C, int_var_ptr); type unsigned is mod 2**32; for unsigned'Size use 32; type long is range -2**31 .. (2**31)-1; for long'Size use 32; type unsigned_long is mod 2**32; for unsigned_long'Size use 32; type unsigned_int is mod 2**32; for unsigned_int'Size use 32; type unsigned_short is mod 2**16; for unsigned_short'Size use 16; type caddr_t is mod 2**32; for caddr_t'Size use 32; type size_t is range -2**31 .. (2**31)-1; for size_t'Size use 32; type size_t_ptr is access constant size_t; pragma Convention (C, size_t_ptr); type size_t_var_ptr is access all size_t; pragma Convention (C, size_t_var_ptr); type time_t is range -2**31 .. (2**31)-1; for time_t'Size use 32; type time_t_ptr is access constant time_t; pragma Convention (C, time_t_ptr); type time_t_var_ptr is access all time_t; pragma Convention (C, time_t_var_ptr); type clock_t is mod 2**32; for clock_t'Size use 32; type clock_t_ptr is access constant clock_t; pragma Convention (C, clock_t_ptr); type clock_t_var_ptr is access all clock_t; pragma Convention (C, clock_t_var_ptr); type ptr_as_int is range -2**31 .. (2**31)-1; for ptr_as_int'Size use 32; subtype char is POSIX_Character; type char_ptr is access constant char; pragma Convention (C, char_ptr); type char_var_ptr is access all char; pragma Convention (C, char_var_ptr); function To_Ptr is new Unchecked_Conversion (Address, char_ptr); function To_char_ptr (Addr : Address) return char_ptr renames To_Ptr; function To_Address is new Unchecked_Conversion (char_ptr, Address); type char_ptr_ptr is access constant char_ptr; pragma Convention (C, char_ptr_ptr); type char_ptr_var_ptr is access all char_ptr; pragma Convention (C, char_ptr_var_ptr); function To_Ptr is new Unchecked_Conversion (Address, char_ptr_ptr); function To_Address is new Unchecked_Conversion (char_ptr_ptr, Address); type char_ptr_array is array (Positive range <>) of aliased char_ptr; function malloc (size : in size_t) return char_ptr; function malloc (size : in size_t) return char_ptr_ptr; pragma Import (C, malloc, "malloc"); procedure free (object : in char_ptr); procedure free (object : in char_ptr_ptr); pragma Import (C, free, "free"); procedure Advance (Ptr : in out char_ptr); procedure Advance (Ptr : in out char_ptr_ptr); -- advance Ptr to next location -- pragma Inline (Advance); function Form_POSIX_String (Str : in char_ptr) return POSIX_String; -- makes new copy of string, without null terminator ----------------- -- constants -- ----------------- AIO_ALLDONE : constant := 1; AIO_CANCELED : constant := 0; AIO_NOTCANCELED : constant := 2; B0 : constant := 0; B110 : constant := 3; B115200 : constant := 0; B1200 : constant := 10; B134 : constant := 4; B150 : constant := 5; B1800 : constant := 11; B19200 : constant := 17; B200 : constant := 6; B230400 : constant := 0; B2400 : constant := 13; B300 : constant := 7; B38400 : constant := 18; B460800 : constant := 0; B4800 : constant := 14; B50 : constant := 1; B57600 : constant := 0; B600 : constant := 8; B75 : constant := 2; B9600 : constant := 16; BRKINT : constant := 2; CLK_TCK : constant := 1000; CLOCAL : constant := 2048; CLOCK_REALTIME : constant := -2; CREAD : constant := 128; CSIZE : constant := 48; CSTOPB : constant := 64; CS5 : constant := 0; CS6 : constant := 16; CS7 : constant := 32; CS8 : constant := 48; -- error code constants are in posix.ads ECHO : constant := 8; ECHOE : constant := 16; ECHOK : constant := 32; ECHONL : constant := 64; FD_CLOEXEC : constant := 1; F_DUPFD : constant := 0; F_GETFD : constant := 1; F_GETFL : constant := 3; F_GETLK : constant := 5; F_OK : constant := 0; F_RDLCK : constant := 1; F_SETFD : constant := 2; F_SETFL : constant := 4; F_SETLK : constant := 6; F_SETLKW : constant := 7; F_UNLCK : constant := 3; F_WRLCK : constant := 2; HUPCL : constant := 1024; ICANON : constant := 2; ICRNL : constant := 256; IEXTEN : constant := 256; IGNBRK : constant := 1; IGNCR : constant := 128; IGNPAR : constant := 4; INLCR : constant := 64; INPCK : constant := 16; ISIG : constant := 1; ISTRIP : constant := 32; IXOFF : constant := 4096; IXON : constant := 1024; L_ctermid : constant := 12; LIO_NOP : constant := -1; LIO_NOWAIT : constant := 2; LIO_READ : constant := 3; LIO_WAIT : constant := 1; LIO_WRITE : constant := 4; MAP_FAILED : constant := -1; -- *** MISSING: MAP_FILE *** -- MAP_FILE : constant := 0; MAP_FIXED : constant := 4; MAP_PRIVATE : constant := 2; MAP_SHARED : constant := 1; MAX_CANON : constant := 256; MAX_INPUT : constant := 512; MCL_CURRENT : constant := 1; MCL_FUTURE : constant := 2; MS_ASYNC : constant := 1; MS_INVALIDATE : constant := 2; MS_SYNC : constant := 4; NCCS : constant := 9; NOFLSH : constant := 128; OPOST : constant := 1; O_ACCMODE : constant := 3; O_APPEND : constant := 4; O_CREAT : constant := 8; O_DSYNC : constant := 131072; O_EXCL : constant := 32; O_NOCTTY : constant := 128; O_NONBLOCK : constant := 64; O_RDONLY : constant := 0; O_RDWR : constant := 2; O_RSYNC : constant := 524288; O_SYNC : constant := 262144; O_TRUNC : constant := 16; O_WRONLY : constant := 1; PAGESIZE : constant := 4096; PARENB : constant := 256; PARMRK : constant := 8; PARODD : constant := 512; PROT_EXEC : constant := 8; PROT_NONE : constant := 1; PROT_READ : constant := 2; PROT_WRITE : constant := 4; -- *** MISSING: PROT_UNCACHE *** -- PROT_UNCACHE : constant := 0; PTHREAD_DESTRUCTOR_ITERATIONS : constant := 4; PTHREAD_EXPLICIT_SCHED : constant := 0; PTHREAD_INHERIT_SCHED : constant := 1; PTHREAD_PRIO_INHERIT : constant := 1; PTHREAD_PRIO_NONE : constant := 0; PTHREAD_PRIO_PROTECT : constant := 2; PTHREAD_PROCESS_SHARED : constant := 0; PTHREAD_PROCESS_PRIVATE : constant := 1; PTHREAD_SCOPE_PROCESS : constant := 0; PTHREAD_SCOPE_SYSTEM : constant := 1; R_OK : constant := 4; SA_NOCLDSTOP : constant := 2; SA_SIGINFO : constant := 128; SCHED_FIFO : constant := 2; SCHED_OTHER : constant := 3; SCHED_RR : constant := 1; SEEK_CUR : constant := 1; SEEK_END : constant := 2; SEEK_SET : constant := 0; SIGTRAP : constant := 5; SIGABRT : constant := 6; SIGALRM : constant := 14; SIGBUS : constant := 10; SIGCHLD : constant := 20; SIGCONT : constant := 19; SIGEV_NONE : constant := 1; SIGEV_SIGNAL : constant := 2; SIGEV_THREAD : constant := 3; SIGFPE : constant := 8; SIGHUP : constant := 1; SIGILL : constant := 4; SIGINT : constant := 2; SIGIO : constant := 23; SIGKILL : constant := 9; SIGPIPE : constant := 13; SIGQUIT : constant := 3; SIGRTMAX : constant := 64; SIGRTMIN : constant := 33; NSIGS : constant := 64; SIGSEGV : constant := 11; SIGSTOP : constant := 17; SIGTERM : constant := 15; SIGTSTP : constant := 18; SIGTTIN : constant := 21; SIGTTOU : constant := 22; SIGURG : constant := 16; SIGUSR1 : constant := 30; SIGUSR2 : constant := 31; SIG_BLOCK : constant := 0; SIG_DFL : constant := 0; SIG_IGN : constant := 1; SIG_SETMASK : constant := 2; SIG_UNBLOCK : constant := 1; SI_ASYNCIO : constant := 4; SI_MESGQ : constant := 5; SI_QUEUE : constant := 2; SI_TIMER : constant := 3; SI_USER : constant := 1; S_IFSOCK : constant := 49152; S_IRGRP : constant := 32; S_IROTH : constant := 4; S_IRUSR : constant := 256; S_IRWXG : constant := 56; S_IRWXO : constant := 7; S_IRWXU : constant := 448; S_ISGID : constant := 1024; S_ISUID : constant := 2048; S_IWGRP : constant := 16; S_IWOTH : constant := 2; S_IWUSR : constant := 128; S_IXGRP : constant := 8; S_IXOTH : constant := 1; S_IXUSR : constant := 64; TCIFLUSH : constant := 1; TCIOFF : constant := 3; TCIOFLUSH : constant := 3; TCION : constant := 4; TCOFLUSH : constant := 2; TCOOFF : constant := 1; TCOON : constant := 2; TCSADRAIN : constant := 3; TCSAFLUSH : constant := 4; TCSANOW : constant := 2; TIMER_ABSTIME : constant := 1; -- *** MISSING: TIMER_RELTIME *** -- TIMER_RELTIME : constant := 0; TOSTOP : constant := 512; VEOF : constant := 4; VEOL : constant := 5; VERASE : constant := 2; VINTR : constant := 0; VKILL : constant := 3; VMIN : constant := 4; VQUIT : constant := 1; VSTART : constant := 6; VSTOP : constant := 8; VSUSP : constant := 7; VTIME : constant := 5; WNOHANG : constant := 1; WUNTRACED : constant := 2; W_OK : constant := 2; X_OK : constant := 1; PC_ASYNC_IO : constant := 10; PC_CHOWN_RESTRICTED : constant := 7; PC_LINK_MAX : constant := 1; PC_MAX_CANON : constant := 2; PC_MAX_INPUT : constant := 3; PC_NAME_MAX : constant := 4; PC_NO_TRUNC : constant := 8; PC_PATH_MAX : constant := 5; PC_PIPE_BUF : constant := 6; PC_PRIO_IO : constant := 12; PC_SYNC_IO : constant := 11; -- *** MISSING: PC_SOCK_MAXBUF *** -- PC_SOCK_MAXBUF : constant := 0; SC_AIO_LISTIO_MAX : constant := 11; SC_AIO_MAX : constant := 12; SC_AIO_PRIO_DELTA_MAX : constant := 13; SC_ARG_MAX : constant := 1; SC_ASYNCHRONOUS_IO : constant := 23; SC_CHILD_MAX : constant := 2; SC_CLK_TCK : constant := 3; SC_DELAYTIMER_MAX : constant := 14; SC_FSYNC : constant := 33; SC_JOB_CONTROL : constant := 6; SC_MAPPED_FILES : constant := 24; SC_MEMLOCK : constant := 25; SC_MEMLOCK_RANGE : constant := 26; SC_MEMORY_PROTECTION : constant := 27; SC_MESSAGE_PASSING : constant := 28; SC_MQ_OPEN_MAX : constant := 15; SC_MQ_PRIO_MAX : constant := 16; SC_NGROUPS_MAX : constant := 4; SC_OPEN_MAX : constant := 5; SC_PAGESIZE : constant := 17; -- *** MISSING: SC_PII *** -- SC_PII : constant := 0; -- *** MISSING: SC_PII_XTI *** -- SC_PII_XTI : constant := 0; -- *** MISSING: SC_PII_SOCKET *** -- SC_PII_SOCKET : constant := 0; -- *** MISSING: SC_PII_INTERNET *** -- SC_PII_INTERNET : constant := 0; -- *** MISSING: SC_PII_INTERNET_STREAM *** -- SC_PII_INTERNET_STREAM : constant := 0; -- *** MISSING: SC_PII_INTERNET_DGRAM *** -- SC_PII_INTERNET_DGRAM : constant := 0; -- *** MISSING: SC_PII_OSI *** -- SC_PII_OSI : constant := 0; -- *** MISSING: SC_PII_OSI_M *** -- SC_PII_OSI_M : constant := 0; -- *** MISSING: SC_PII_OSI_COTS *** -- SC_PII_OSI_COTS : constant := 0; -- *** MISSING: SC_PII_OSI_CLTS *** -- SC_PII_OSI_CLTS : constant := 0; -- *** MISSING: SC_PII_NET_SUPPORT *** -- SC_PII_NET_SUPPORT : constant := 0; -- *** MISSING: SC_POLL *** -- SC_POLL : constant := 0; -- *** MISSING: SC_POSIX_PII_NET_SUPPORT *** -- SC_POSIX_PII_NET_SUPPORT : constant := 0; SC_PRIORITIZED_IO : constant := 29; SC_PRIORITY_SCHEDULING : constant := 30; -- *** MISSING: SC_SELECT *** -- SC_SELECT : constant := 0; SC_THREAD_PROCESS_SHARED : constant := 1043; SC_REALTIME_SIGNALS : constant := 31; SC_RTSIG_MAX : constant := 18; SC_SAVED_IDS : constant := 7; SC_SEMAPHORES : constant := 32; SC_SEM_NSEMS_MAX : constant := 19; SC_SEM_VALUE_MAX : constant := 20; SC_SHARED_MEMORY_OBJECTS : constant := 34; SC_SIGQUEUE_MAX : constant := 21; SC_STREAM_MAX : constant := 9; SC_SYNCHRONIZED_IO : constant := 35; SC_THREAD_PRIORITY_SCHEDULING : constant := 1040; SC_THREAD_PRIO_INHERIT : constant := 1041; SC_THREAD_PRIO_PROTECT : constant := 1042; SC_TIMERS : constant := 36; SC_TIMER_MAX : constant := 22; SC_TZNAME_MAX : constant := 10; -- *** MISSING: SC_T_IOV_MAX *** -- SC_T_IOV_MAX : constant := 0; -- *** MISSING: SC_UIO_MAXIOV *** -- SC_UIO_MAXIOV : constant := 0; SC_VERSION : constant := 8; ------------------------ -- type definitions -- ------------------------ type off_t is range -2**31 .. (2**31)-1; for off_t'Size use 32; type pid_t is range -2**31 .. (2**31)-1; for pid_t'Size use 32; type gid_t is mod 2**32; for gid_t'Size use 32; type uid_t is mod 2**32; for uid_t'Size use 32; type mode_t is mod 2**32; for mode_t'Size use 32; type suseconds_t is range -2**31 .. (2**31)-1; for suseconds_t'Size use 32; type ssize_t is range -2**31 .. (2**31)-1; for ssize_t'Size use 32; type DIR is array (1 .. 1) of int; for DIR'Alignment use ALIGNMENT; for DIR'Size use 32; type DIR_ptr is access constant DIR; pragma Convention (C, DIR_ptr); type DIR_var_ptr is access all DIR; pragma Convention (C, DIR_var_ptr); type ino_t is mod 2**32; for ino_t'Size use 32; type dev_t is mod 2**32; for dev_t'Size use 32; type cc_t is mod 2**8; for cc_t'Size use 8; type nlink_t is mod 2**32; for nlink_t'Size use 32; type tcflag_t is mod 2**16; for tcflag_t'Size use 16; type clockid_t is range -2**31 .. (2**31)-1; for clockid_t'Size use 32; type mqd_t is range -2**31 .. (2**31)-1; for mqd_t'Size use 32; type pthread_attr_t is array (1 .. 16) of int; for pthread_attr_t'Alignment use ALIGNMENT; for pthread_attr_t'Size use 512; type pthread_attr_t_ptr is access constant pthread_attr_t; pragma Convention (C, pthread_attr_t_ptr); type pthread_attr_t_var_ptr is access all pthread_attr_t; pragma Convention (C, pthread_attr_t_var_ptr); type pthread_cond_t is array (1 .. 5) of int; for pthread_cond_t'Alignment use ALIGNMENT; for pthread_cond_t'Size use 160; type pthread_cond_t_ptr is access constant pthread_cond_t; pragma Convention (C, pthread_cond_t_ptr); type pthread_cond_t_var_ptr is access all pthread_cond_t; pragma Convention (C, pthread_cond_t_var_ptr); type pthread_condattr_t is array (1 .. 3) of int; for pthread_condattr_t'Alignment use ALIGNMENT; for pthread_condattr_t'Size use 96; type pthread_condattr_t_ptr is access constant pthread_condattr_t; pragma Convention (C, pthread_condattr_t_ptr); type pthread_condattr_t_var_ptr is access all pthread_condattr_t; pragma Convention (C, pthread_condattr_t_var_ptr); type pthread_key_t is array (1 .. 1) of int; for pthread_key_t'Alignment use ALIGNMENT; for pthread_key_t'Size use 32; type pthread_key_t_ptr is access constant pthread_key_t; pragma Convention (C, pthread_key_t_ptr); type pthread_key_t_var_ptr is access all pthread_key_t; pragma Convention (C, pthread_key_t_var_ptr); type pthread_mutex_t is array (1 .. 7) of int; for pthread_mutex_t'Alignment use ALIGNMENT; for pthread_mutex_t'Size use 224; type pthread_mutex_t_ptr is access constant pthread_mutex_t; pragma Convention (C, pthread_mutex_t_ptr); type pthread_mutex_t_var_ptr is access all pthread_mutex_t; pragma Convention (C, pthread_mutex_t_var_ptr); type pthread_mutexattr_t is array (1 .. 3) of int; for pthread_mutexattr_t'Alignment use ALIGNMENT; for pthread_mutexattr_t'Size use 96; type pthread_mutexattr_t_ptr is access constant pthread_mutexattr_t; pragma Convention (C, pthread_mutexattr_t_ptr); type pthread_mutexattr_t_var_ptr is access all pthread_mutexattr_t; pragma Convention (C, pthread_mutexattr_t_var_ptr); type pthread_once_t is array (1 .. 1) of int; for pthread_once_t'Alignment use ALIGNMENT; for pthread_once_t'Size use 32; type pthread_once_t_ptr is access constant pthread_once_t; pragma Convention (C, pthread_once_t_ptr); type pthread_once_t_var_ptr is access all pthread_once_t; pragma Convention (C, pthread_once_t_var_ptr); type pthread_t is array (1 .. 2) of char; for pthread_t'Alignment use ALIGNMENT; type pthread_t_ptr is access constant pthread_t; pragma Convention (C, pthread_t_ptr); type pthread_t_var_ptr is access all pthread_t; pragma Convention (C, pthread_t_var_ptr); type sem_t is array (1 .. 3) of int; for sem_t'Alignment use ALIGNMENT; for sem_t'Size use 96; type sem_t_ptr is access constant sem_t; pragma Convention (C, sem_t_ptr); type sem_t_var_ptr is access all sem_t; pragma Convention (C, sem_t_var_ptr); type sigset_t is array (1 .. 2) of int; for sigset_t'Alignment use ALIGNMENT; for sigset_t'Size use 64; type sigset_t_ptr is access constant sigset_t; pragma Convention (C, sigset_t_ptr); type sigset_t_var_ptr is access all sigset_t; pragma Convention (C, sigset_t_var_ptr); type speed_t is mod 2**32; for speed_t'Size use 32; type timer_t is mod 2**32; for timer_t'Size use 32; type sigval (Dummy : Boolean := True) is record case Dummy is when True => sival_int : int; when False => sival_ptr : System.Address; end case; end record; pragma Unchecked_Union (sigval); null_sigval : constant sigval := (Dummy => False, sival_ptr => System.Null_Address); sigval_byte_size : constant := 4; sigval_alignment : constant := ALIGNMENT; type siginfo_t is record si_signo : int; si_code : int; si_value : sigval; end record; for siginfo_t use record si_signo at 0 range 0 .. 31; si_code at 8 range 0 .. 31; si_value at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, siginfo_t); for siginfo_t'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for siginfo_t'Size use 320; pragma Warnings (On); type siginfo_t_ptr is access constant siginfo_t; pragma Convention (C, siginfo_t_ptr); type siginfo_t_var_ptr is access all siginfo_t; pragma Convention (C, siginfo_t_var_ptr); ----------------------- -- structure types -- ----------------------- type struct_sigevent is record sigev_notify : int; sigev_signo : int; sigev_value : sigval; sigev_notify_function : System.Address; sigev_notify_attributes : System.Address; end record; for struct_sigevent use record sigev_notify at 0 range 0 .. 31; sigev_signo at 4 range 0 .. 31; sigev_value at 8 range 0 .. 31; sigev_notify_function at 12 range 0 .. 31; sigev_notify_attributes at 16 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_sigevent); for struct_sigevent'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_sigevent'Size use 160; pragma Warnings (On); type sigevent_ptr is access constant struct_sigevent; pragma Convention (C, sigevent_ptr); type sigevent_var_ptr is access all struct_sigevent; pragma Convention (C, sigevent_var_ptr); type struct_aiocb is record aio_fildes : int; aio_offset : off_t; aio_buf : System.Address; pragma Volatile (aio_buf); aio_nbytes : size_t; aio_reqprio : int; aio_sigevent : struct_sigevent; aio_lio_opcode : int; aio_errno : int; end record; for struct_aiocb use record aio_fildes at 0 range 0 .. 31; aio_offset at 4 range 0 .. 31; aio_buf at 8 range 0 .. 31; aio_nbytes at 12 range 0 .. 31; aio_reqprio at 16 range 0 .. 31; aio_sigevent at 20 range 0 .. 159; aio_lio_opcode at 40 range 0 .. 31; aio_errno at 52 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_aiocb); for struct_aiocb'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_aiocb'Size use 544; pragma Warnings (On); type aiocb_ptr is access constant struct_aiocb; pragma Convention (C, aiocb_ptr); type aiocb_var_ptr is access all struct_aiocb; pragma Convention (C, aiocb_var_ptr); type struct_dirent is record d_name : POSIX_String (1 .. 1); end record; for struct_dirent use record d_name at 8 range 0 .. 7; end record; pragma Convention (C_Pass_By_Copy, struct_dirent); for struct_dirent'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_dirent'Size use 2112; pragma Warnings (On); type dirent_ptr is access constant struct_dirent; pragma Convention (C, dirent_ptr); type dirent_var_ptr is access all struct_dirent; pragma Convention (C, dirent_var_ptr); type struct_flock is record l_type : short; l_whence : short; l_start : off_t; l_len : off_t; l_pid : pid_t; end record; for struct_flock use record l_type at 0 range 0 .. 15; l_whence at 2 range 0 .. 15; l_start at 4 range 0 .. 31; l_len at 8 range 0 .. 31; l_pid at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_flock); for struct_flock'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_flock'Size use 128; pragma Warnings (On); type flock_ptr is access constant struct_flock; pragma Convention (C, flock_ptr); type flock_var_ptr is access all struct_flock; pragma Convention (C, flock_var_ptr); type struct_group is record gr_name : char_ptr; gr_gid : gid_t; gr_mem : char_ptr_ptr; end record; for struct_group use record gr_name at 0 range 0 .. 31; gr_gid at 8 range 0 .. 31; gr_mem at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_group); for struct_group'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_group'Size use 128; pragma Warnings (On); type group_ptr is access constant struct_group; pragma Convention (C, group_ptr); type group_var_ptr is access all struct_group; pragma Convention (C, group_var_ptr); type struct_mq_attr is record mq_flags : long; mq_maxmsg : long; mq_msgsize : long; mq_curmsgs : long; end record; for struct_mq_attr use record mq_flags at 0 range 0 .. 31; mq_maxmsg at 4 range 0 .. 31; mq_msgsize at 8 range 0 .. 31; mq_curmsgs at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_mq_attr); for struct_mq_attr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_mq_attr'Size use 608; pragma Warnings (On); type mq_attr_ptr is access constant struct_mq_attr; pragma Convention (C, mq_attr_ptr); type mq_attr_var_ptr is access all struct_mq_attr; pragma Convention (C, mq_attr_var_ptr); type struct_passwd is record pw_name : char_ptr; pw_uid : uid_t; pw_gid : gid_t; pw_dir : char_ptr; pw_shell : char_ptr; end record; for struct_passwd use record pw_name at 0 range 0 .. 31; pw_uid at 8 range 0 .. 31; pw_gid at 12 range 0 .. 31; pw_dir at 28 range 0 .. 31; pw_shell at 32 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_passwd); for struct_passwd'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_passwd'Size use 288; pragma Warnings (On); type passwd_ptr is access constant struct_passwd; pragma Convention (C, passwd_ptr); type passwd_var_ptr is access all struct_passwd; pragma Convention (C, passwd_var_ptr); type struct_sigaction is record sa_handler : System.Address; sa_mask : sigset_t; sa_flags : int; end record; for struct_sigaction use record sa_handler at 0 range 0 .. 31; sa_mask at 4 range 0 .. 63; sa_flags at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_sigaction); for struct_sigaction'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_sigaction'Size use 128; pragma Warnings (On); type sigaction_ptr is access constant struct_sigaction; pragma Convention (C, sigaction_ptr); type sigaction_var_ptr is access all struct_sigaction; pragma Convention (C, sigaction_var_ptr); type struct_sched_param is record sched_priority : int; end record; for struct_sched_param use record sched_priority at 0 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_sched_param); for struct_sched_param'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_sched_param'Size use 224; pragma Warnings (On); type sched_param_ptr is access constant struct_sched_param; pragma Convention (C, sched_param_ptr); type sched_param_var_ptr is access all struct_sched_param; pragma Convention (C, sched_param_var_ptr); type cc_t_array is array (0 .. NCCS - 1) of cc_t; type struct_stat is record st_mode : mode_t; st_ino : ino_t; st_dev : dev_t; st_nlink : nlink_t; st_uid : uid_t; st_gid : gid_t; st_size : off_t; st_atime : time_t; st_mtime : time_t; st_ctime : time_t; end record; for struct_stat use record st_mode at 8 range 0 .. 31; st_ino at 4 range 0 .. 31; st_dev at 0 range 0 .. 31; st_nlink at 12 range 0 .. 31; st_uid at 16 range 0 .. 31; st_gid at 20 range 0 .. 31; st_size at 28 range 0 .. 31; st_atime at 32 range 0 .. 31; st_mtime at 36 range 0 .. 31; st_ctime at 40 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_stat); for struct_stat'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_stat'Size use 416; pragma Warnings (On); type stat_ptr is access constant struct_stat; pragma Convention (C, stat_ptr); type stat_var_ptr is access all struct_stat; pragma Convention (C, stat_var_ptr); function To_Stat_Ptr is new Unchecked_Conversion (Address, stat_ptr); type struct_termios is record c_iflag : tcflag_t; c_oflag : tcflag_t; c_cflag : tcflag_t; c_lflag : tcflag_t; c_cc : cc_t_array; end record; for struct_termios use record c_iflag at 0 range 0 .. 15; c_oflag at 2 range 0 .. 15; c_cflag at 4 range 0 .. 15; c_lflag at 6 range 0 .. 15; c_cc at 9 range 0 .. 71; end record; pragma Convention (C_Pass_By_Copy, struct_termios); for struct_termios'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_termios'Size use 144; pragma Warnings (On); type termios_ptr is access constant struct_termios; pragma Convention (C, termios_ptr); type termios_var_ptr is access all struct_termios; pragma Convention (C, termios_var_ptr); -- timeval structure -- type struct_timeval is record tv_sec : time_t; tv_usec : suseconds_t; end record; for struct_timeval use record tv_sec at 0 range 0 .. 31; tv_usec at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_timeval); for struct_timeval'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_timeval'Size use 64; pragma Warnings (On); type timeval_ptr is access constant struct_timeval; pragma Convention (C, timeval_ptr); type timeval_var_ptr is access all struct_timeval; pragma Convention (C, timeval_var_ptr); type struct_timespec is record tv_sec : time_t; tv_nsec : long; end record; for struct_timespec use record tv_sec at 0 range 0 .. 31; tv_nsec at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_timespec); for struct_timespec'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_timespec'Size use 64; pragma Warnings (On); type timespec_ptr is access constant struct_timespec; pragma Convention (C, timespec_ptr); type timespec_var_ptr is access all struct_timespec; pragma Convention (C, timespec_var_ptr); type struct_itimerspec is record it_interval : struct_timespec; it_value : struct_timespec; end record; for struct_itimerspec use record it_interval at 0 range 0 .. 63; it_value at 8 range 0 .. 63; end record; pragma Convention (C_Pass_By_Copy, struct_itimerspec); for struct_itimerspec'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_itimerspec'Size use 128; pragma Warnings (On); type itimerspec_ptr is access constant struct_itimerspec; pragma Convention (C, itimerspec_ptr); type itimerspec_var_ptr is access all struct_itimerspec; pragma Convention (C, itimerspec_var_ptr); type struct_tm is record tm_sec : int; tm_min : int; tm_hour : int; tm_mday : int; tm_mon : int; tm_year : int; tm_wday : int; tm_yday : int; tm_isdst : int; end record; for struct_tm use record tm_sec at 0 range 0 .. 31; tm_min at 4 range 0 .. 31; tm_hour at 8 range 0 .. 31; tm_mday at 12 range 0 .. 31; tm_mon at 16 range 0 .. 31; tm_year at 20 range 0 .. 31; tm_wday at 24 range 0 .. 31; tm_yday at 28 range 0 .. 31; tm_isdst at 32 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_tm); for struct_tm'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_tm'Size use 288; pragma Warnings (On); type tm_ptr is access constant struct_tm; pragma Convention (C, tm_ptr); type tm_var_ptr is access all struct_tm; pragma Convention (C, tm_var_ptr); type struct_tms is record tms_utime : clock_t; tms_stime : clock_t; tms_cutime : clock_t; tms_cstime : clock_t; end record; for struct_tms use record tms_utime at 0 range 0 .. 31; tms_stime at 4 range 0 .. 31; tms_cutime at 8 range 0 .. 31; tms_cstime at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_tms); for struct_tms'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_tms'Size use 128; pragma Warnings (On); type tms_ptr is access constant struct_tms; pragma Convention (C, tms_ptr); type tms_var_ptr is access all struct_tms; pragma Convention (C, tms_var_ptr); type struct_utimbuf is record modtime : time_t; actime : time_t; end record; for struct_utimbuf use record modtime at 4 range 0 .. 31; actime at 0 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_utimbuf); for struct_utimbuf'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_utimbuf'Size use 64; pragma Warnings (On); type utimbuf_ptr is access constant struct_utimbuf; pragma Convention (C, utimbuf_ptr); type utimbuf_var_ptr is access all struct_utimbuf; pragma Convention (C, utimbuf_var_ptr); subtype utsname_sysname_string is POSIX_String (1 .. 256); subtype utsname_nodename_string is POSIX_String (1 .. 256); subtype utsname_release_string is POSIX_String (1 .. 9); subtype utsname_version_string is POSIX_String (1 .. 9); subtype utsname_machine_string is POSIX_String (1 .. 9); type struct_utsname is record sysname : utsname_sysname_string; nodename : utsname_nodename_string; release : utsname_release_string; version : utsname_version_string; machine : utsname_machine_string; end record; for struct_utsname use record sysname at 0 range 0 .. 2047; nodename at 256 range 0 .. 2047; release at 512 range 0 .. 71; version at 521 range 0 .. 71; machine at 530 range 0 .. 71; end record; pragma Convention (C_Pass_By_Copy, struct_utsname); for struct_utsname'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_utsname'Size use 4312; pragma Warnings (On); type utsname_ptr is access constant struct_utsname; pragma Convention (C, utsname_ptr); type utsname_var_ptr is access all struct_utsname; pragma Convention (C, utsname_var_ptr); ---------------------------------- -- link names for C functions -- ---------------------------------- HAVE_access : constant Boolean := True; access_LINKNAME : constant String := "access"; HAVE_aio_cancel : constant Boolean := True; aio_cancel_LINKNAME : constant String := "aio_cancel"; HAVE_aio_error : constant Boolean := True; aio_error_LINKNAME : constant String := "aio_error"; HAVE_aio_fsync : constant Boolean := True; aio_fsync_LINKNAME : constant String := "aio_fsync"; HAVE_aio_read : constant Boolean := True; aio_read_LINKNAME : constant String := "aio_read"; HAVE_aio_return : constant Boolean := True; aio_return_LINKNAME : constant String := "aio_return"; HAVE_aio_suspend : constant Boolean := True; aio_suspend_LINKNAME : constant String := "aio_suspend"; HAVE_aio_write : constant Boolean := True; aio_write_LINKNAME : constant String := "aio_write"; HAVE_cfgetispeed : constant Boolean := True; cfgetispeed_LINKNAME : constant String := "cfgetispeed"; HAVE_cfgetospeed : constant Boolean := True; cfgetospeed_LINKNAME : constant String := "cfgetospeed"; HAVE_cfsetispeed : constant Boolean := True; cfsetispeed_LINKNAME : constant String := "cfsetispeed"; HAVE_cfsetospeed : constant Boolean := True; cfsetospeed_LINKNAME : constant String := "cfsetospeed"; HAVE_chdir : constant Boolean := True; chdir_LINKNAME : constant String := "chdir"; HAVE_chmod : constant Boolean := True; chmod_LINKNAME : constant String := "chmod"; HAVE_chown : constant Boolean := True; chown_LINKNAME : constant String := "chown"; HAVE_clock_getres : constant Boolean := True; clock_getres_LINKNAME : constant String := "clock_getres"; HAVE_clock_gettime : constant Boolean := True; clock_gettime_LINKNAME : constant String := "clock_gettime"; HAVE_clock_settime : constant Boolean := True; clock_settime_LINKNAME : constant String := "clock_settime"; HAVE_close : constant Boolean := True; close_LINKNAME : constant String := "close"; HAVE_closedir : constant Boolean := True; closedir_LINKNAME : constant String := "closedir"; HAVE_ctermid : constant Boolean := True; ctermid_LINKNAME : constant String := "ctermid"; HAVE_ctime : constant Boolean := True; ctime_LINKNAME : constant String := "ctime"; HAVE_ctime_r : constant Boolean := True; ctime_r_LINKNAME : constant String := "ctime_r"; HAVE_dup : constant Boolean := True; dup_LINKNAME : constant String := "dup"; HAVE_dup2 : constant Boolean := True; dup2_LINKNAME : constant String := "dup2"; HAVE_execl : constant Boolean := True; execl_LINKNAME : constant String := "execl"; HAVE_execle : constant Boolean := True; execle_LINKNAME : constant String := "execle"; HAVE_execlp : constant Boolean := True; execlp_LINKNAME : constant String := "execlp"; HAVE_execv : constant Boolean := True; execv_LINKNAME : constant String := "execv"; HAVE_execve : constant Boolean := True; execve_LINKNAME : constant String := "execve"; HAVE_execvp : constant Boolean := True; execvp_LINKNAME : constant String := "execvp"; HAVE_fchmod : constant Boolean := True; fchmod_LINKNAME : constant String := "fchmod"; HAVE_fcntl : constant Boolean := True; fcntl_LINKNAME : constant String := "fcntl"; HAVE_fdatasync : constant Boolean := True; fdatasync_LINKNAME : constant String := "fdatasync"; HAVE_fork : constant Boolean := True; fork_LINKNAME : constant String := "fork"; HAVE_fpathconf : constant Boolean := True; fpathconf_LINKNAME : constant String := "fpathconf"; HAVE_fstat : constant Boolean := True; fstat_LINKNAME : constant String := "fstat"; HAVE_fsync : constant Boolean := True; fsync_LINKNAME : constant String := "fsync"; HAVE_ftruncate : constant Boolean := True; ftruncate_LINKNAME : constant String := "ftruncate"; HAVE_getcwd : constant Boolean := True; getcwd_LINKNAME : constant String := "getcwd"; HAVE_getegid : constant Boolean := True; getegid_LINKNAME : constant String := "getegid"; HAVE_getenv : constant Boolean := True; getenv_LINKNAME : constant String := "getenv"; HAVE_geteuid : constant Boolean := True; geteuid_LINKNAME : constant String := "geteuid"; HAVE_getgid : constant Boolean := True; getgid_LINKNAME : constant String := "getgid"; HAVE_getgrgid : constant Boolean := True; getgrgid_LINKNAME : constant String := "getgrgid"; HAVE_getgrnam : constant Boolean := True; getgrnam_LINKNAME : constant String := "getgrnam"; HAVE_getgroups : constant Boolean := True; getgroups_LINKNAME : constant String := "getgroups"; HAVE_getlogin : constant Boolean := True; getlogin_LINKNAME : constant String := "getlogin"; HAVE_getpgrp : constant Boolean := True; getpgrp_LINKNAME : constant String := "getpgrp"; HAVE_getpid : constant Boolean := True; getpid_LINKNAME : constant String := "getpid"; HAVE_getppid : constant Boolean := True; getppid_LINKNAME : constant String := "getppid"; HAVE_getpwnam : constant Boolean := True; getpwnam_LINKNAME : constant String := "getpwnam"; HAVE_getpwuid : constant Boolean := True; getpwuid_LINKNAME : constant String := "getpwuid"; HAVE_gettimeofday : constant Boolean := True; gettimeofday_LINKNAME : constant String := "gettimeofday"; HAVE_getuid : constant Boolean := True; getuid_LINKNAME : constant String := "getuid"; HAVE_gmtime_r : constant Boolean := True; gmtime_r_LINKNAME : constant String := "gmtime_r"; HAVE_isatty : constant Boolean := True; isatty_LINKNAME : constant String := "isatty"; HAVE_kill : constant Boolean := True; kill_LINKNAME : constant String := "kill"; HAVE_link : constant Boolean := True; link_LINKNAME : constant String := "link"; HAVE_lio_listio : constant Boolean := True; lio_listio_LINKNAME : constant String := "lio_listio"; HAVE_lstat : constant Boolean := True; lstat_LINKNAME : constant String := "lstat"; HAVE_lseek : constant Boolean := True; lseek_LINKNAME : constant String := "lseek"; HAVE_mkdir : constant Boolean := True; mkdir_LINKNAME : constant String := "mkdir"; HAVE_mkfifo : constant Boolean := True; mkfifo_LINKNAME : constant String := "mkfifo"; HAVE_mlock : constant Boolean := True; mlock_LINKNAME : constant String := "mlock"; HAVE_mlockall : constant Boolean := True; mlockall_LINKNAME : constant String := "mlockall"; HAVE_mmap : constant Boolean := True; mmap_LINKNAME : constant String := "mmap"; HAVE_mprotect : constant Boolean := True; mprotect_LINKNAME : constant String := "mprotect"; HAVE_mq_close : constant Boolean := True; mq_close_LINKNAME : constant String := "mq_close"; HAVE_mq_getattr : constant Boolean := True; mq_getattr_LINKNAME : constant String := "mq_getattr"; HAVE_mq_notify : constant Boolean := True; mq_notify_LINKNAME : constant String := "mq_notify"; HAVE_mq_open : constant Boolean := True; mq_open_LINKNAME : constant String := "mq_open"; HAVE_mq_receive : constant Boolean := True; mq_receive_LINKNAME : constant String := "mq_receive"; HAVE_mq_send : constant Boolean := True; mq_send_LINKNAME : constant String := "mq_send"; HAVE_mq_setattr : constant Boolean := True; mq_setattr_LINKNAME : constant String := "mq_setattr"; HAVE_mq_unlink : constant Boolean := True; mq_unlink_LINKNAME : constant String := "mq_unlink"; HAVE_msync : constant Boolean := True; msync_LINKNAME : constant String := "msync"; HAVE_munlock : constant Boolean := True; munlock_LINKNAME : constant String := "munlock"; HAVE_munlockall : constant Boolean := True; munlockall_LINKNAME : constant String := "munlockall"; HAVE_munmap : constant Boolean := True; munmap_LINKNAME : constant String := "munmap"; HAVE_open : constant Boolean := True; open_LINKNAME : constant String := "open"; HAVE_opendir : constant Boolean := True; opendir_LINKNAME : constant String := "opendir"; HAVE_pathconf : constant Boolean := True; pathconf_LINKNAME : constant String := "pathconf"; HAVE_pipe : constant Boolean := True; pipe_LINKNAME : constant String := "pipe"; pthread_cond_broadcast_LINKNAME : constant String := "pthread_cond_broadcast"; pthread_cond_destroy_LINKNAME : constant String := "pthread_cond_destroy"; pthread_cond_init_LINKNAME : constant String := "pthread_cond_init"; pthread_cond_signal_LINKNAME : constant String := "pthread_cond_signal"; pthread_cond_timedwait_LINKNAME : constant String := "pthread_cond_timedwait"; pthread_cond_wait_LINKNAME : constant String := "pthread_cond_wait"; pthread_condattr_destroy_LINKNAME : constant String := "pthread_condattr_destroy"; pthread_condattr_getpshared_LINKNAME : constant String := "pthread_condattr_getpshared"; pthread_condattr_init_LINKNAME : constant String := "pthread_condattr_init"; pthread_condattr_setpshared_LINKNAME : constant String := "pthread_condattr_setpshared"; pthread_mutex_destroy_LINKNAME : constant String := "pthread_mutex_destroy"; pthread_mutex_getprioceiling_LINKNAME : constant String := "pthread_mutex_getprioceiling"; pthread_mutex_init_LINKNAME : constant String := "pthread_mutex_init"; pthread_mutex_lock_LINKNAME : constant String := "pthread_mutex_lock"; pthread_mutex_setprioceiling_LINKNAME : constant String := "pthread_mutex_setprioceiling"; pthread_mutex_trylock_LINKNAME : constant String := "pthread_mutex_trylock"; pthread_mutex_unlock_LINKNAME : constant String := "pthread_mutex_unlock"; pthread_mutexattr_destroy_LINKNAME : constant String := "pthread_mutexattr_destroy"; pthread_mutexattr_getprioceiling_LINKNAME : constant String := "pthread_mutexattr_getprioceiling"; pthread_mutexattr_getprotocol_LINKNAME : constant String := "pthread_mutexattr_getprotocol"; pthread_mutexattr_getpshared_LINKNAME : constant String := "pthread_mutexattr_getpshared"; pthread_mutexattr_init_LINKNAME : constant String := "pthread_mutexattr_init"; pthread_mutexattr_setprioceiling_LINKNAME : constant String := "pthread_mutexattr_setprioceiling"; pthread_mutexattr_setprotocol_LINKNAME : constant String := "pthread_mutexattr_setprotocol"; pthread_mutexattr_setpshared_LINKNAME : constant String := "pthread_mutexattr_setpshared"; pthread_sigmask_LINKNAME : constant String := "pthread_sigmask"; HAVE_putenv : constant Boolean := True; putenv_LINKNAME : constant String := "putenv"; HAVE_read : constant Boolean := True; read_LINKNAME : constant String := "read"; HAVE_readdir : constant Boolean := True; readdir_LINKNAME : constant String := "readdir"; HAVE_readdir_r : constant Boolean := True; readdir_r_LINKNAME : constant String := "readdir_r"; HAVE_rename : constant Boolean := True; rename_LINKNAME : constant String := "rename"; HAVE_rmdir : constant Boolean := True; rmdir_LINKNAME : constant String := "rmdir"; HAVE_sched_get_priority_max : constant Boolean := True; sched_get_priority_max_LINKNAME : constant String := "sched_get_priority_max"; HAVE_sched_get_priority_min : constant Boolean := True; sched_get_priority_min_LINKNAME : constant String := "sched_get_priority_min"; HAVE_sched_rr_get_interval : constant Boolean := True; sched_rr_get_interval_LINKNAME : constant String := "sched_rr_get_interval"; HAVE_sched_getparam : constant Boolean := True; sched_getparam_LINKNAME : constant String := "sched_getparam"; HAVE_sched_getscheduler : constant Boolean := True; sched_getscheduler_LINKNAME : constant String := "sched_getscheduler"; HAVE_sched_setparam : constant Boolean := True; sched_setparam_LINKNAME : constant String := "sched_setparam"; HAVE_sched_setscheduler : constant Boolean := True; sched_setscheduler_LINKNAME : constant String := "sched_setscheduler"; HAVE_sched_yield : constant Boolean := True; sched_yield_LINKNAME : constant String := "sched_yield"; HAVE_sem_close : constant Boolean := True; sem_close_LINKNAME : constant String := "sem_close"; HAVE_sem_destroy : constant Boolean := True; sem_destroy_LINKNAME : constant String := "sem_destroy"; HAVE_sem_getvalue : constant Boolean := True; sem_getvalue_LINKNAME : constant String := "sem_getvalue"; HAVE_sem_init : constant Boolean := True; sem_init_LINKNAME : constant String := "sem_init"; HAVE_sem_open : constant Boolean := True; sem_open_LINKNAME : constant String := "sem_open"; HAVE_sem_post : constant Boolean := True; sem_post_LINKNAME : constant String := "sem_post"; HAVE_sem_trywait : constant Boolean := True; sem_trywait_LINKNAME : constant String := "sem_trywait"; HAVE_sem_unlink : constant Boolean := True; sem_unlink_LINKNAME : constant String := "sem_unlink"; HAVE_sem_wait : constant Boolean := True; sem_wait_LINKNAME : constant String := "sem_wait"; HAVE_setenv : constant Boolean := True; setenv_LINKNAME : constant String := "setenv"; HAVE_setgid : constant Boolean := True; setgid_LINKNAME : constant String := "setgid"; HAVE_setpgid : constant Boolean := True; setpgid_LINKNAME : constant String := "setpgid"; HAVE_setsid : constant Boolean := True; setsid_LINKNAME : constant String := "setsid"; HAVE_setuid : constant Boolean := True; setuid_LINKNAME : constant String := "setuid"; HAVE_shm_open : constant Boolean := True; shm_open_LINKNAME : constant String := "shm_open"; HAVE_shm_unlink : constant Boolean := True; shm_unlink_LINKNAME : constant String := "shm_unlink"; HAVE_sigaction : constant Boolean := True; sigaction_LINKNAME : constant String := "sigaction"; HAVE_sigaddset : constant Boolean := True; sigaddset_LINKNAME : constant String := "sigaddset"; HAVE_sigdelset : constant Boolean := True; sigdelset_LINKNAME : constant String := "sigdelset"; HAVE_sigemptyset : constant Boolean := True; sigemptyset_LINKNAME : constant String := "sigemptyset"; HAVE_sigfillset : constant Boolean := True; sigfillset_LINKNAME : constant String := "sigfillset"; HAVE_sigismember : constant Boolean := True; sigismember_LINKNAME : constant String := "sigismember"; HAVE_sigpending : constant Boolean := True; sigpending_LINKNAME : constant String := "sigpending"; HAVE_sigprocmask : constant Boolean := True; sigprocmask_LINKNAME : constant String := "sigprocmask"; HAVE_sigqueue : constant Boolean := True; sigqueue_LINKNAME : constant String := "sigqueue"; HAVE_sigtimedwait : constant Boolean := True; sigtimedwait_LINKNAME : constant String := "sigtimedwait"; HAVE_sigwait : constant Boolean := True; sigwait_LINKNAME : constant String := "sigwait"; HAVE_sigwaitinfo : constant Boolean := True; sigwaitinfo_LINKNAME : constant String := "sigwaitinfo"; HAVE_stat : constant Boolean := True; stat_LINKNAME : constant String := "stat"; HAVE_sysconf : constant Boolean := True; sysconf_LINKNAME : constant String := "sysconf"; HAVE_tcdrain : constant Boolean := True; tcdrain_LINKNAME : constant String := "tcdrain"; HAVE_tcflow : constant Boolean := True; tcflow_LINKNAME : constant String := "tcflow"; HAVE_tcflush : constant Boolean := True; tcflush_LINKNAME : constant String := "tcflush"; HAVE_tcgetattr : constant Boolean := True; tcgetattr_LINKNAME : constant String := "tcgetattr"; HAVE_tcgetpgrp : constant Boolean := True; tcgetpgrp_LINKNAME : constant String := "tcgetpgrp"; HAVE_tcsendbreak : constant Boolean := True; tcsendbreak_LINKNAME : constant String := "tcsendbreak"; HAVE_tcsetattr : constant Boolean := True; tcsetattr_LINKNAME : constant String := "tcsetattr"; HAVE_tcsetpgrp : constant Boolean := True; tcsetpgrp_LINKNAME : constant String := "tcsetpgrp"; HAVE_time : constant Boolean := True; time_LINKNAME : constant String := "time"; HAVE_timer_create : constant Boolean := True; timer_create_LINKNAME : constant String := "timer_create"; HAVE_timer_delete : constant Boolean := True; timer_delete_LINKNAME : constant String := "timer_delete"; HAVE_timer_getoverrun : constant Boolean := True; timer_getoverrun_LINKNAME : constant String := "timer_getoverrun"; HAVE_timer_gettime : constant Boolean := True; timer_gettime_LINKNAME : constant String := "timer_gettime"; HAVE_timer_settime : constant Boolean := True; timer_settime_LINKNAME : constant String := "timer_settime"; HAVE_times : constant Boolean := True; times_LINKNAME : constant String := "times"; HAVE_ttyname : constant Boolean := True; ttyname_LINKNAME : constant String := "ttyname"; HAVE_umask : constant Boolean := True; umask_LINKNAME : constant String := "umask"; HAVE_uname : constant Boolean := True; uname_LINKNAME : constant String := "uname"; HAVE_unlink : constant Boolean := True; unlink_LINKNAME : constant String := "unlink"; HAVE_unsetenv : constant Boolean := True; unsetenv_LINKNAME : constant String := "unsetenv"; HAVE_utime : constant Boolean := True; utime_LINKNAME : constant String := "utime"; HAVE_waitpid : constant Boolean := True; waitpid_LINKNAME : constant String := "waitpid"; HAVE_write : constant Boolean := True; write_LINKNAME : constant String := "write"; ------------------------------ -- C functions for macros -- ------------------------------ function s_isdir (mode : mode_t) return int; pragma Import (C, s_isdir, "s_isdir"); function s_ischr (mode : mode_t) return int; pragma Import (C, s_ischr, "s_ischr"); function s_isblk (mode : mode_t) return int; pragma Import (C, s_isblk, "s_isblk"); function s_islnk (mode : mode_t) return int; pragma Import (C, s_islnk, "s_islnk"); function s_isreg (mode : mode_t) return int; pragma Import (C, s_isreg, "s_isreg"); function s_isfifo (mode : mode_t) return int; pragma Import (C, s_isfifo, "s_isfifo"); function s_ismsg (mode : mode_t) return int; pragma Import (C, s_ismsg, "s_ismsg"); function s_issem (mode : mode_t) return int; pragma Import (C, s_issem, "s_issem"); function s_isshm (mode : mode_t) return int; pragma Import (C, s_isshm, "s_isshm"); function s_issock (mode : mode_t) return int; pragma Import (C, s_issock, "s_issock"); function s_typeismq (stat : stat_ptr) return int; pragma Import (C, s_typeismq, "s_typeismq"); function s_typeissem (stat : stat_ptr) return int; pragma Import (C, s_typeissem, "s_typeissem"); function s_typeisshm (stat : stat_ptr) return int; pragma Import (C, s_typeisshm, "s_typeisshm"); function wifexited (stat_val : int) return int; pragma Import (C, wifexited, "wifexited"); function wifexitstatus (stat_val : int) return int; pragma Import (C, wifexitstatus, "wifexitstatus"); function wifsignaled (stat_val : int) return int; pragma Import (C, wifsignaled, "wifsignaled"); function wiftermsig (stat_val : int) return int; pragma Import (C, wiftermsig, "wiftermsig"); function wifstopped (stat_val : int) return int; pragma Import (C, wifstopped, "wifstopped"); function wifstopsig (stat_val : int) return int; pragma Import (C, wifstopsig, "wifstopsig"); package Sockets is ---------------- -- socket.h -- ---------------- type sa_family_t is mod 2**8; for sa_family_t'Size use 8; -- *** MISSING: in_port_t *** -- type in_port_t is mod 2**16; for in_port_t'Size use 16; ----------------- -- constants -- ----------------- HOST_NOT_FOUND : constant := 1; NO_DATA : constant := 4; NO_RECOVERY : constant := 3; TRY_AGAIN : constant := 2; -- *** MISSING: MAX_SOCKADDR_EXT *** -- MAX_SOCKADDR_EXT : constant := 108; -- sockets protocol level -- SOL_SOCKET : constant := 65535; -- socket types -- SOCK_STREAM : constant := 1; SOCK_DGRAM : constant := 2; SOCK_RAW : constant := 3; SOCK_SEQPACKET : constant := 5; -- address families -- AF_MAX : constant := 35; AF_UNSPEC : constant := 0; AF_UNIX : constant := 1; AF_LOCAL : constant := 1; AF_INET : constant := 2; AF_OSI : constant := 7; AF_ISO : constant := 7; -- protocol families -- PF_MAX : constant := 35; PF_UNSPEC : constant := 0; PF_LOCAL : constant := 1; PF_UNIX : constant := 1; PF_INET : constant := 2; PF_OSI : constant := 7; PF_ISO : constant := 7; -- socket options -- SO_BROADCAST : constant := 32; SO_DEBUG : constant := 1; SO_DONTROUTE : constant := 16; SO_ERROR : constant := 4103; SO_KEEPALIVE : constant := 8; SO_LINGER : constant := 128; SO_OOBINLINE : constant := 256; SO_RCVBUF : constant := 4098; SO_RCVLOWAT : constant := 4100; SO_RCVTIMEO : constant := 4102; SO_REUSEADDR : constant := 4; SO_SNDBUF : constant := 4097; SO_SNDLOWAT : constant := 4099; SO_SNDTIMEO : constant := 4101; SO_TYPE : constant := 4104; -- max queued connections -- SOMAXCONN : constant := 128; -- send & receive option flag bits -- MSG_OOB : constant := 1; MSG_PEEK : constant := 2; MSG_DONTROUTE : constant := 4; MSG_EOR : constant := 128; MSG_TRUNC : constant := 32; MSG_CTRUNC : constant := 8; MSG_WAITALL : constant := 256; -- *** MISSING: MSG_MAXIOVLEN *** -- MSG_MAXIOVLEN : constant := 0; -- socket address information option flag bits -- AI_PASSIVE : constant := 1; AI_CANONNAME : constant := 2; -- scoket shutdown mode flag bits -- SHUT_RD : constant := 0; SHUT_WR : constant := 1; SHUT_RDWR : constant := 2; ------------------ -- structures -- ------------------ -- generic socket address -- type struct_sockaddr is record sa_family : sa_family_t; sa_data : POSIX_String (1 .. 14); end record; for struct_sockaddr use record sa_family at 1 range 0 .. 7; sa_data at 2 range 0 .. 111; end record; pragma Convention (C_Pass_By_Copy, struct_sockaddr); for struct_sockaddr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_sockaddr'Size use 128; pragma Warnings (On); type sockaddr_ptr is access constant struct_sockaddr; pragma Convention (C, sockaddr_ptr); type sockaddr_var_ptr is access all struct_sockaddr; pragma Convention (C, sockaddr_var_ptr); -- struct addrinfo... -- type struct_addrinfo; type addrinfo_ptr is access constant struct_addrinfo; pragma Convention (C, addrinfo_ptr); type addrinfo_var_ptr is access all struct_addrinfo; pragma Convention (C, addrinfo_var_ptr); type struct_addrinfo is record ai_flags : int; ai_family : int; ai_socktype : int; ai_protocol : int; ai_addrlen : size_t; ai_addr : sockaddr_ptr; ai_canonname : char_ptr; ai_next : addrinfo_ptr; end record; for struct_addrinfo use record ai_flags at 0 range 0 .. 31; ai_family at 4 range 0 .. 31; ai_socktype at 8 range 0 .. 31; ai_protocol at 12 range 0 .. 31; ai_addrlen at 16 range 0 .. 31; ai_addr at 24 range 0 .. 31; ai_canonname at 20 range 0 .. 31; ai_next at 28 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_addrinfo); for struct_addrinfo'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_addrinfo'Size use 256; pragma Warnings (On); -- message option header -- type struct_cmsghdr is record cmsg_level : int; cmsg_type : int; cmsg_len : size_t; end record; for struct_cmsghdr use record cmsg_level at 4 range 0 .. 31; cmsg_type at 8 range 0 .. 31; cmsg_len at 0 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_cmsghdr); for struct_cmsghdr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_cmsghdr'Size use 96; pragma Warnings (On); type cmsghdr_ptr is access constant struct_cmsghdr; pragma Convention (C, cmsghdr_ptr); type cmsghdr_var_ptr is access all struct_cmsghdr; pragma Convention (C, cmsghdr_var_ptr); -- host database entry -- type struct_hostent is record h_name : char_ptr; h_aliases : char_ptr_ptr; h_addrtype : int; h_length : int; h_addr_list : char_ptr_ptr; end record; for struct_hostent use record h_name at 0 range 0 .. 31; h_aliases at 4 range 0 .. 31; h_addrtype at 8 range 0 .. 31; h_length at 12 range 0 .. 31; h_addr_list at 16 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_hostent); for struct_hostent'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_hostent'Size use 160; pragma Warnings (On); type hostent_ptr is access constant struct_hostent; pragma Convention (C, hostent_ptr); type hostent_var_ptr is access all struct_hostent; pragma Convention (C, hostent_var_ptr); -- internet address -- type in_addr_t is mod 2**32; for in_addr_t'Size use 32; type struct_in_addr is record s_addr : in_addr_t; end record; for struct_in_addr use record s_addr at 0 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_in_addr); for struct_in_addr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_in_addr'Size use 32; pragma Warnings (On); type in_addr_ptr is access constant struct_in_addr; pragma Convention (C, in_addr_ptr); type in_addr_var_ptr is access all struct_in_addr; pragma Convention (C, in_addr_var_ptr); -- linger option structure -- type struct_linger is record l_onoff : int; l_linger : int; end record; for struct_linger use record l_onoff at 0 range 0 .. 31; l_linger at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_linger); for struct_linger'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_linger'Size use 64; pragma Warnings (On); type linger_ptr is access constant struct_linger; pragma Convention (C, linger_ptr); type linger_var_ptr is access all struct_linger; pragma Convention (C, linger_var_ptr); -- I/O vector -- type struct_iovec is record iov_base : char_ptr; iov_len : size_t; end record; for struct_iovec use record iov_base at 0 range 0 .. 31; iov_len at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_iovec); for struct_iovec'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_iovec'Size use 64; pragma Warnings (On); type iovec_ptr is access constant struct_iovec; pragma Convention (C, iovec_ptr); type iovec_var_ptr is access all struct_iovec; pragma Convention (C, iovec_var_ptr); -- message header -- type struct_msghdr is record msg_name : sockaddr_ptr; msg_namelen : size_t; msg_iov : iovec_ptr; msg_iovlen : size_t; msg_control : char_ptr; msg_controllen : size_t; msg_flags : int; end record; for struct_msghdr use record msg_name at 0 range 0 .. 31; msg_namelen at 4 range 0 .. 31; msg_iov at 8 range 0 .. 31; msg_iovlen at 12 range 0 .. 31; msg_control at 16 range 0 .. 31; msg_controllen at 20 range 0 .. 31; msg_flags at 24 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_msghdr); for struct_msghdr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_msghdr'Size use 224; pragma Warnings (On); type msghdr_ptr is access constant struct_msghdr; pragma Convention (C, msghdr_ptr); type msghdr_var_ptr is access all struct_msghdr; pragma Convention (C, msghdr_var_ptr); -- local socket address -- subtype sun_path_string is POSIX_String (1 .. 108); type struct_sockaddr_un is record sun_family : sa_family_t; sun_path : sun_path_string; end record; for struct_sockaddr_un use record sun_family at 0 range 0 .. 7; sun_path at 2 range 0 .. 863; end record; pragma Convention (C_Pass_By_Copy, struct_sockaddr_un); for struct_sockaddr_un'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_sockaddr_un'Size use 880; pragma Warnings (On); type sockaddr_un_ptr is access constant struct_sockaddr_un; pragma Convention (C, sockaddr_un_ptr); type sockaddr_un_var_ptr is access all struct_sockaddr_un; pragma Convention (C, sockaddr_un_var_ptr); -- internet socket address -- type struct_sockaddr_in is record sin_family : sa_family_t; sin_port : in_port_t; sin_addr : struct_in_addr; sin_zero : POSIX_String (1 .. 8); end record; for struct_sockaddr_in use record sin_family at 1 range 0 .. 7; sin_port at 2 range 0 .. 15; sin_addr at 4 range 0 .. 31; sin_zero at 8 range 0 .. 63; end record; pragma Convention (C_Pass_By_Copy, struct_sockaddr_in); for struct_sockaddr_in'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_sockaddr_in'Size use 128; pragma Warnings (On); type sockaddr_in_ptr is access constant struct_sockaddr_in; pragma Convention (C, sockaddr_in_ptr); type sockaddr_in_var_ptr is access all struct_sockaddr_in; pragma Convention (C, sockaddr_in_var_ptr); -- IP Level ip_opts structure -- -- *** MISSING: ip_opts *** -- type struct_ip_opts is record ip_dst : struct_in_addr; ip_opts : POSIX.Octet_Array (1 .. 40); end record; for struct_ip_opts use record ip_dst at 0 range 0 .. 31; ip_opts at 4 range 0 .. 319; end record; pragma Convention (C_Pass_By_Copy, struct_ip_opts); for struct_ip_opts'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_ip_opts'Size use 352; pragma Warnings (On); type ip_opts_ptr is access constant struct_ip_opts; pragma Convention (C, ip_opts_ptr); type ip_opts_var_ptr is access all struct_ip_opts; pragma Convention (C, ip_opts_var_ptr); -------------------------------- -- link names for functions -- -------------------------------- HAVE_accept : constant Boolean := True; accept_LINKNAME : constant String := "accept"; HAVE_bind : constant Boolean := True; bind_LINKNAME : constant String := "bind"; HAVE_connect : constant Boolean := True; connect_LINKNAME : constant String := "connect"; HAVE_getsockname : constant Boolean := True; getsockname_LINKNAME : constant String := "getsockname"; HAVE_getsockopt : constant Boolean := True; getsockopt_LINKNAME : constant String := "getsockopt"; -- *** MISSING: function isfdtype *** -- HAVE_isfdtype : constant Boolean := False; isfdtype_LINKNAME : constant String := "nosys_neg_one"; HAVE_listen : constant Boolean := True; listen_LINKNAME : constant String := "listen"; HAVE_recv : constant Boolean := True; recv_LINKNAME : constant String := "recv"; HAVE_recvfrom : constant Boolean := True; recvfrom_LINKNAME : constant String := "recvfrom"; HAVE_recvmsg : constant Boolean := True; recvmsg_LINKNAME : constant String := "recvmsg"; HAVE_send : constant Boolean := True; send_LINKNAME : constant String := "send"; HAVE_sendto : constant Boolean := True; sendto_LINKNAME : constant String := "sendto"; HAVE_sendmsg : constant Boolean := True; sendmsg_LINKNAME : constant String := "sendmsg"; HAVE_setsockopt : constant Boolean := True; setsockopt_LINKNAME : constant String := "setsockopt"; HAVE_shutdown : constant Boolean := True; shutdown_LINKNAME : constant String := "shutdown"; HAVE_socket : constant Boolean := True; socket_LINKNAME : constant String := "socket"; -- *** MISSING: function sockatmark *** -- HAVE_sockatmark : constant Boolean := False; sockatmark_LINKNAME : constant String := "nosys_neg_one"; HAVE_socketpair : constant Boolean := True; socketpair_LINKNAME : constant String := "socketpair"; end Sockets; package XTI is ---------------------- -- XTI structures -- ---------------------- -- netbuf structure -- type struct_netbuf is record maxlen : unsigned_int; len : unsigned_int; buf : char_ptr; end record; for struct_netbuf use record maxlen at 0 range 0 .. 31; len at 4 range 0 .. 31; buf at 8 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_netbuf); for struct_netbuf'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_netbuf'Size use 96; pragma Warnings (On); type netbuf_ptr is access constant struct_netbuf; pragma Convention (C, netbuf_ptr); type netbuf_var_ptr is access all struct_netbuf; pragma Convention (C, netbuf_var_ptr); -- t_info structure -- type struct_t_info is record addr : long; options : long; tsdu : long; etsdu : long; connect : long; discon : long; servtype : long; end record; for struct_t_info use record addr at 0 range 0 .. 31; options at 4 range 0 .. 31; tsdu at 8 range 0 .. 31; etsdu at 12 range 0 .. 31; connect at 16 range 0 .. 31; discon at 20 range 0 .. 31; servtype at 24 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_info); for struct_t_info'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_info'Size use 224; pragma Warnings (On); type t_info_ptr is access constant struct_t_info; pragma Convention (C, t_info_ptr); type t_info_var_ptr is access all struct_t_info; pragma Convention (C, t_info_var_ptr); -- t_opthdr structure -- -- *** MISSING: t_opthdr *** -- type struct_t_opthdr is record len : unsigned_long; level : unsigned_long; name : unsigned_long; status : unsigned_long; end record; for struct_t_opthdr use record len at 0 range 0 .. 31; level at 4 range 0 .. 31; name at 8 range 0 .. 31; status at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_opthdr); for struct_t_opthdr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_opthdr'Size use 128; pragma Warnings (On); type t_opthdr_ptr is access constant struct_t_opthdr; pragma Convention (C, t_opthdr_ptr); type t_opthdr_var_ptr is access all struct_t_opthdr; pragma Convention (C, t_opthdr_var_ptr); -- t_bind structure -- type struct_t_bind is record addr : struct_netbuf; qlen : unsigned; end record; for struct_t_bind use record addr at 0 range 0 .. 95; qlen at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_bind); for struct_t_bind'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_bind'Size use 128; pragma Warnings (On); type t_bind_ptr is access constant struct_t_bind; pragma Convention (C, t_bind_ptr); type t_bind_var_ptr is access all struct_t_bind; pragma Convention (C, t_bind_var_ptr); -- t_optmgmt structure -- type struct_t_optmgmt is record opt : struct_netbuf; flags : long; end record; for struct_t_optmgmt use record opt at 0 range 0 .. 95; flags at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_optmgmt); for struct_t_optmgmt'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_optmgmt'Size use 128; pragma Warnings (On); type t_optmgmt_ptr is access constant struct_t_optmgmt; pragma Convention (C, t_optmgmt_ptr); type t_optmgmt_var_ptr is access all struct_t_optmgmt; pragma Convention (C, t_optmgmt_var_ptr); -- t_discon structure -- type struct_t_discon is record udata : struct_netbuf; reason : int; sequence : int; end record; for struct_t_discon use record udata at 0 range 0 .. 95; reason at 12 range 0 .. 31; sequence at 16 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_discon); for struct_t_discon'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_discon'Size use 160; pragma Warnings (On); type t_discon_ptr is access constant struct_t_discon; pragma Convention (C, t_discon_ptr); type t_discon_var_ptr is access all struct_t_discon; pragma Convention (C, t_discon_var_ptr); -- t_call structure -- type struct_t_call is record addr : struct_netbuf; opt : struct_netbuf; udata : struct_netbuf; sequence : int; end record; for struct_t_call use record addr at 0 range 0 .. 95; opt at 12 range 0 .. 95; udata at 24 range 0 .. 95; sequence at 36 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_call); for struct_t_call'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_call'Size use 320; pragma Warnings (On); type t_call_ptr is access constant struct_t_call; pragma Convention (C, t_call_ptr); type t_call_var_ptr is access all struct_t_call; pragma Convention (C, t_call_var_ptr); -- t_unitdata structure -- type struct_t_unitdata is record addr : struct_netbuf; opt : struct_netbuf; udata : struct_netbuf; end record; for struct_t_unitdata use record addr at 0 range 0 .. 95; opt at 12 range 0 .. 95; udata at 24 range 0 .. 95; end record; pragma Convention (C_Pass_By_Copy, struct_t_unitdata); for struct_t_unitdata'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_unitdata'Size use 288; pragma Warnings (On); type t_unitdata_ptr is access constant struct_t_unitdata; pragma Convention (C, t_unitdata_ptr); type t_unitdata_var_ptr is access all struct_t_unitdata; pragma Convention (C, t_unitdata_var_ptr); -- t_uderr structure -- type struct_t_uderr is record addr : struct_netbuf; opt : struct_netbuf; error : long; end record; for struct_t_uderr use record addr at 0 range 0 .. 95; opt at 12 range 0 .. 95; error at 24 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_uderr); for struct_t_uderr'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_uderr'Size use 224; pragma Warnings (On); type t_uderr_ptr is access constant struct_t_uderr; pragma Convention (C, t_uderr_ptr); type t_uderr_var_ptr is access all struct_t_uderr; pragma Convention (C, t_uderr_var_ptr); -- t_iovec structure -- -- *** MISSING: t_iovec *** -- type struct_t_iovec is record iov_base : char_ptr; iov_len : unsigned_int; end record; for struct_t_iovec use record iov_base at 0 range 0 .. 31; iov_len at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_iovec); for struct_t_iovec'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_iovec'Size use 64; pragma Warnings (On); type t_iovec_ptr is access constant struct_t_iovec; pragma Convention (C, t_iovec_ptr); type t_iovec_var_ptr is access all struct_t_iovec; pragma Convention (C, t_iovec_var_ptr); -- t_kpalive structure -- -- *** MISSING: t_kpalive *** -- type struct_t_kpalive is record kp_onoff : long; kp_timeout : long; end record; for struct_t_kpalive use record kp_onoff at 0 range 0 .. 31; kp_timeout at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_kpalive); for struct_t_kpalive'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_kpalive'Size use 64; pragma Warnings (On); type t_kpalive_ptr is access constant struct_t_kpalive; pragma Convention (C, t_kpalive_ptr); type t_kpalive_var_ptr is access all struct_t_kpalive; pragma Convention (C, t_kpalive_var_ptr); -- The following are the events returned from t_look() -- T_LISTEN : constant := 1; T_CONNECT : constant := 2; T_DATA : constant := 4; T_EXDATA : constant := 8; T_DISCONNECT : constant := 16; T_UDERR : constant := 64; T_ORDREL : constant := 128; -- *** MISSING: T_GODATA *** -- T_GODATA : constant := 0; -- *** MISSING: T_GOEXDATA *** -- T_GOEXDATA : constant := 0; T_EVENTS : constant := 255; T_MORE : constant := 1; T_EXPEDITED : constant := 2; -- *** MISSING: T_PUSH *** -- T_PUSH : constant := 0; T_NEGOTIATE : constant := 4; T_CHECK : constant := 8; T_DEFAULT : constant := 16; T_SUCCESS : constant := 32; T_FAILURE : constant := 64; -- *** MISSING: T_CURRENT *** -- T_CURRENT : constant := 0; -- *** MISSING: T_PARTSUCCESS *** -- T_PARTSUCCESS : constant := 0; -- *** MISSING: T_READONLY *** -- T_READONLY : constant := 0; -- *** MISSING: T_NOTSUPPORT *** -- T_NOTSUPPORT : constant := 0; -- *** MISSING: T_RAW *** -- T_RAW : constant := 0; -- Service types defines -- T_COTS : constant := 1; T_COTS_ORD : constant := 2; T_CLTS : constant := 3; -- *** MISSING: T_SENDZERO *** -- T_SENDZERO : constant := 0; -- *** MISSING: SENDZERO *** -- SENDZERO : constant := 0; -- *** MISSING: T_XPG4_1 *** -- T_XPG4_1 : constant := 0; -- *** MISSING: XPG4_1 *** -- XPG4_1 : constant := 0; T_BIND : constant := 1; T_OPTMGMT : constant := 2; T_CALL : constant := 3; T_DIS : constant := 4; T_UNITDATA : constant := 5; T_UDERROR : constant := 6; T_INFO : constant := 7; -- *** MISSING: T_KUNITDATA *** -- T_KUNITDATA : constant := 0; T_ADDR : constant := 1; T_OPT : constant := 2; T_UDATA : constant := 4; T_ALL : constant := 7; T_UNINIT : constant := 0; T_UNBND : constant := 1; T_IDLE : constant := 2; T_OUTCON : constant := 3; T_INCON : constant := 4; T_DATAXFER : constant := 5; T_OUTREL : constant := 6; T_INREL : constant := 7; T_YES : constant := 1; T_NO : constant := 0; T_UNUSED : constant := -1; T_NULL : constant := 0; T_ABSREQ : constant := 32768; T_INFINITE : constant := -1; T_INVALID : constant := -2; -- XTI-level Options -- XTI_GENERIC : constant := 65535; XTI_DEBUG : constant := 1; XTI_LINGER : constant := 128; XTI_RCVBUF : constant := 4098; XTI_RCVLOWAT : constant := 4100; XTI_SNDBUF : constant := 4097; XTI_SNDLOWAT : constant := 4099; -- t_linger structure -- -- *** MISSING: t_linger *** -- type struct_t_linger is record l_onoff : long; l_linger : long; end record; for struct_t_linger use record l_onoff at 0 range 0 .. 31; l_linger at 4 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_t_linger); for struct_t_linger'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_t_linger'Size use 64; pragma Warnings (On); type t_linger_ptr is access constant struct_t_linger; pragma Convention (C, t_linger_ptr); type t_linger_var_ptr is access all struct_t_linger; pragma Convention (C, t_linger_var_ptr); -- General definitions for option management -- T_UNSPEC : constant := -3; T_ALLOPT : constant := 0; function c_T_ALIGN (p : char_ptr) return int; pragma Import (C, c_T_ALIGN, "c_T_ALIGN"); -- TCP Level and Options -- -- *** MISSING: INET_TCP *** -- INET_TCP : constant := 0; TCP_NODELAY : constant := 1; TCP_MAXSEG : constant := 2; TCP_KEEPALIVE : constant := 8; T_GARBAGE : constant := 2; -- UDP Level and Options -- -- *** MISSING: INET_UDP *** -- INET_UDP : constant := 0; -- *** MISSING: UDP_CHECKSUM *** -- UDP_CHECKSUM : constant := 0; -- IP Level and Options -- -- *** MISSING: INET_IP *** -- INET_IP : constant := 0; IP_OPTIONS : constant := 1; IP_TOS : constant := 3; IP_TTL : constant := 4; IP_REUSEADDR : constant := 4; IP_DONTROUTE : constant := 16; IP_BROADCAST : constant := 32; -- IP_TOS precedence levels -- -- *** MISSING: T_ROUTINE *** -- T_ROUTINE : constant := 0; -- *** MISSING: T_PRIORITY *** -- T_PRIORITY : constant := 0; -- *** MISSING: T_IMMEDIATE *** -- T_IMMEDIATE : constant := 0; -- *** MISSING: T_FLASH *** -- T_FLASH : constant := 0; -- *** MISSING: T_OVERRIDEFLASH *** -- T_OVERRIDEFLASH : constant := 0; -- *** MISSING: T_CRITIC_ECP *** -- T_CRITIC_ECP : constant := 0; -- *** MISSING: T_INETCONTROL *** -- T_INETCONTROL : constant := 0; -- *** MISSING: T_NETCONTROL *** -- T_NETCONTROL : constant := 0; -- IP_TOS type of service -- -- *** MISSING: T_NOTOS *** -- T_NOTOS : constant := 0; -- *** MISSING: T_LDELAY *** -- T_LDELAY : constant := 0; -- *** MISSING: T_HITHRPT *** -- T_HITHRPT : constant := 0; -- *** MISSING: T_HIREL *** -- T_HIREL : constant := 0; -------------------------------- -- link names for functions -- -------------------------------- -- *** MISSING: function t_accept *** -- HAVE_t_accept : constant Boolean := False; t_accept_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_alloc *** -- HAVE_t_alloc : constant Boolean := False; t_alloc_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_bind *** -- HAVE_t_bind : constant Boolean := False; t_bind_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_blocking *** -- HAVE_t_blocking : constant Boolean := False; t_blocking_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_close *** -- HAVE_t_close : constant Boolean := False; t_close_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_connect *** -- HAVE_t_connect : constant Boolean := False; t_connect_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_error *** -- HAVE_t_error : constant Boolean := False; t_error_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_free *** -- HAVE_t_free : constant Boolean := False; t_free_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_getinfo *** -- HAVE_t_getinfo : constant Boolean := False; t_getinfo_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_getprotaddr *** -- HAVE_t_getprotaddr : constant Boolean := False; t_getprotaddr_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_getstate *** -- HAVE_t_getstate : constant Boolean := False; t_getstate_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_listen *** -- HAVE_t_listen : constant Boolean := False; t_listen_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_look *** -- HAVE_t_look : constant Boolean := False; t_look_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_nonblocking *** -- HAVE_t_nonblocking : constant Boolean := False; t_nonblocking_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_open *** -- HAVE_t_open : constant Boolean := False; t_open_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_optmgmt *** -- HAVE_t_optmgmt : constant Boolean := False; t_optmgmt_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcv *** -- HAVE_t_rcv : constant Boolean := False; t_rcv_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvconnect *** -- HAVE_t_rcvconnect : constant Boolean := False; t_rcvconnect_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvdis *** -- HAVE_t_rcvdis : constant Boolean := False; t_rcvdis_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvrel *** -- HAVE_t_rcvrel : constant Boolean := False; t_rcvrel_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvreldata *** -- HAVE_t_rcvreldata : constant Boolean := False; t_rcvreldata_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvudata *** -- HAVE_t_rcvudata : constant Boolean := False; t_rcvudata_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvuderr *** -- HAVE_t_rcvuderr : constant Boolean := False; t_rcvuderr_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvv *** -- HAVE_t_rcvv : constant Boolean := False; t_rcvv_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_rcvvudata *** -- HAVE_t_rcvvudata : constant Boolean := False; t_rcvvudata_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_snd *** -- HAVE_t_snd : constant Boolean := False; t_snd_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_snddis *** -- HAVE_t_snddis : constant Boolean := False; t_snddis_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_sndudata *** -- HAVE_t_sndudata : constant Boolean := False; t_sndudata_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_sndrel *** -- HAVE_t_sndrel : constant Boolean := False; t_sndrel_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_sndreldata *** -- HAVE_t_sndreldata : constant Boolean := False; t_sndreldata_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_sndv *** -- HAVE_t_sndv : constant Boolean := False; t_sndv_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_sndvudata *** -- HAVE_t_sndvudata : constant Boolean := False; t_sndvudata_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_strerror *** -- HAVE_t_strerror : constant Boolean := False; t_strerror_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_sync *** -- HAVE_t_sync : constant Boolean := False; t_sync_LINKNAME : constant String := "nosys_neg_one"; -- *** MISSING: function t_unbind *** -- HAVE_t_unbind : constant Boolean := False; t_unbind_LINKNAME : constant String := "nosys_neg_one"; end XTI; package Netinet is ------------------------- -- From netinet/in.h -- ------------------------- IPPROTO_IP : constant := 0; IPPROTO_ICMP : constant := 1; IPPROTO_TCP : constant := 6; IPPROTO_UDP : constant := 17; IPPROTO_RAW : constant := 255; IP_OPTIONS : constant := 1; IP_HDRINCL : constant := 2; IP_TOS : constant := 3; IP_TTL : constant := 4; IP_RECVDSTADDR : constant := 7; INADDR_NONE : constant := 4294967295; INADDR_ANY : constant := 0; INADDR_BROADCAST : constant := 4294967295; INADDR_LOOPBACK : constant := 2130706433; INADDR_UNSPEC_GROUP : constant := 3758096384; INADDR_ALLHOSTS_GROUP : constant := 3758096385; INADDR_MAX_LOCAL_GROUP : constant := 3758096639; HAVE_inet_addr : constant Boolean := True; inet_addr_LINKNAME : constant String := "inet_addr"; HAVE_inet_makeaddr : constant Boolean := True; inet_makeaddr_LINKNAME : constant String := "inet_makeaddr"; HAVE_inet_network : constant Boolean := True; inet_network_LINKNAME : constant String := "inet_network"; HAVE_inet_lnaof : constant Boolean := True; inet_lnaof_LINKNAME : constant String := "inet_lnaof"; HAVE_inet_netof : constant Boolean := True; inet_netof_LINKNAME : constant String := "inet_netof"; HAVE_inet_ntoa : constant Boolean := True; inet_ntoa_LINKNAME : constant String := "inet_ntoa"; -------------------------- -- From netinet/tcp.h -- -------------------------- TCP_NODELAY : constant := 1; TCP_MAXSEG : constant := 2; -- *** MISSING: TCP_KEEPALIVE *** -- TCP_KEEPALIVE : constant := 0; -- *** MISSING: TCP_MAXRXT *** -- TCP_MAXRXT : constant := 0; -- *** MISSING: TCP_STDURG *** -- TCP_STDURG : constant := 0; ------------------------- -- From netinet/ip.h -- ------------------------- -- *** MISSING: IPTOS_LOWDELAY *** -- IPTOS_LOWDELAY : constant := 0; -- *** MISSING: IPTOS_THROUGHPUT *** -- IPTOS_THROUGHPUT : constant := 0; -- *** MISSING: IPTOS_RELIABILITY *** -- IPTOS_RELIABILITY : constant := 0; end Netinet; package NetDB is use Sockets; type struct_netent is record n_name : char_ptr; n_aliases : char_ptr_ptr; n_addrtype : int; n_net : in_addr_t; end record; for struct_netent use record n_name at 0 range 0 .. 31; n_aliases at 4 range 0 .. 31; n_addrtype at 8 range 0 .. 31; n_net at 12 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_netent); for struct_netent'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_netent'Size use 128; pragma Warnings (On); type netent_ptr is access constant struct_netent; pragma Convention (C, netent_ptr); type netent_var_ptr is access all struct_netent; pragma Convention (C, netent_var_ptr); -- protocol database entry -- type struct_protoent is record p_name : char_ptr; p_aliases : char_ptr_ptr; p_proto : int; end record; for struct_protoent use record p_name at 0 range 0 .. 31; p_aliases at 4 range 0 .. 31; p_proto at 8 range 0 .. 31; end record; pragma Convention (C_Pass_By_Copy, struct_protoent); for struct_protoent'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_protoent'Size use 96; pragma Warnings (On); type protoent_ptr is access constant struct_protoent; pragma Convention (C, protoent_ptr); type protoent_var_ptr is access all struct_protoent; pragma Convention (C, protoent_var_ptr); -- local socket address -- HAVE_endhostent : constant Boolean := True; endhostent_LINKNAME : constant String := "endhostent"; HAVE_endnetent : constant Boolean := True; endnetent_LINKNAME : constant String := "endnetent"; HAVE_endprotoent : constant Boolean := True; endprotoent_LINKNAME : constant String := "endprotoent"; HAVE_endservent : constant Boolean := True; endservent_LINKNAME : constant String := "endservent"; HAVE_getaddrinfo : constant Boolean := True; getaddrinfo_LINKNAME : constant String := "getaddrinfo"; HAVE_freeaddrinfo : constant Boolean := True; freeaddrinfo_LINKNAME : constant String := "freeaddrinfo"; HAVE_getnameinfo : constant Boolean := True; getnameinfo_LINKNAME : constant String := "getnameinfo"; HAVE_gethostbyaddr : constant Boolean := True; gethostbyaddr_LINKNAME : constant String := "gethostbyaddr"; -- *** MISSING: function gethostbyaddr_r *** -- HAVE_gethostbyaddr_r : constant Boolean := False; gethostbyaddr_r_LINKNAME : constant String := "nosys_neg_one"; HAVE_gethostbyname : constant Boolean := True; gethostbyname_LINKNAME : constant String := "gethostbyname"; -- *** MISSING: function gethostbyname_r *** -- HAVE_gethostbyname_r : constant Boolean := False; gethostbyname_r_LINKNAME : constant String := "nosys_neg_one"; HAVE_gethostname : constant Boolean := True; gethostname_LINKNAME : constant String := "gethostname"; HAVE_getnetbyaddr : constant Boolean := True; getnetbyaddr_LINKNAME : constant String := "getnetbyaddr"; -- *** MISSING: function getnetbyaddr_r *** -- HAVE_getnetbyaddr_r : constant Boolean := False; getnetbyaddr_r_LINKNAME : constant String := "nosys_neg_one"; HAVE_getnetbyname : constant Boolean := True; getnetbyname_LINKNAME : constant String := "getnetbyname"; -- *** MISSING: function getnetbyname_r *** -- HAVE_getnetbyname_r : constant Boolean := False; getnetbyname_r_LINKNAME : constant String := "nosys_neg_one"; HAVE_getpeername : constant Boolean := True; getpeername_LINKNAME : constant String := "getpeername"; HAVE_getprotobyname : constant Boolean := True; getprotobyname_LINKNAME : constant String := "getprotobyname"; -- *** MISSING: function getprotobyname_r *** -- HAVE_getprotobyname_r : constant Boolean := False; getprotobyname_r_LINKNAME : constant String := "nosys_neg_one"; HAVE_getprotobynumber : constant Boolean := True; getprotobynumber_LINKNAME : constant String := "getprotobynumber"; -- *** MISSING: function getprotobynumber_r *** -- HAVE_getprotobynumber_r : constant Boolean := False; getprotobynumber_r_LINKNAME : constant String := "nosys_neg_one"; HAVE_getservbyname : constant Boolean := True; getservbyname_LINKNAME : constant String := "getservbyname"; -- *** MISSING: function getservbyname_r *** -- HAVE_getservbyname_r : constant Boolean := False; getservbyname_r_LINKNAME : constant String := "nosys_neg_one"; HAVE_getservbyport : constant Boolean := True; getservbyport_LINKNAME : constant String := "getservbyport"; -- *** MISSING: function getservbyport_r *** -- HAVE_getservbyport_r : constant Boolean := False; getservbyport_r_LINKNAME : constant String := "nosys_neg_one"; HAVE_sethostent : constant Boolean := True; sethostent_LINKNAME : constant String := "sethostent"; HAVE_setnetent : constant Boolean := True; setnetent_LINKNAME : constant String := "setnetent"; HAVE_setprotoent : constant Boolean := True; setprotoent_LINKNAME : constant String := "setprotoent"; HAVE_setservent : constant Boolean := True; setservent_LINKNAME : constant String := "setservent"; end NetDB; -- pollfd structure -- type struct_pollfd is record fd : int; events : short; revents : short; end record; for struct_pollfd use record fd at 0 range 0 .. 31; events at 4 range 0 .. 15; revents at 6 range 0 .. 15; end record; pragma Convention (C_Pass_By_Copy, struct_pollfd); for struct_pollfd'Alignment use ALIGNMENT; pragma Warnings (Off); -- There may be holes in the record, due to -- components not defined by POSIX standard. for struct_pollfd'Size use 64; pragma Warnings (On); type pollfd_ptr is access constant struct_pollfd; pragma Convention (C, pollfd_ptr); type pollfd_var_ptr is access all struct_pollfd; pragma Convention (C, pollfd_var_ptr); type fd_mask_array is array (Integer range <>) of unsigned_int; -- fd_set structure -- type fd_set is array (1 .. 8) of int; for fd_set'Alignment use ALIGNMENT; for fd_set'Size use 256; type fd_set_ptr is access constant fd_set; pragma Convention (C, fd_set_ptr); type fd_set_var_ptr is access all fd_set; pragma Convention (C, fd_set_var_ptr); FD_SETSIZE : constant := 256; -- *** MISSING: INFTIM *** -- INFTIM : constant := 0; POLLIN : constant := 1; -- *** MISSING: POLLRDNORM *** -- POLLRDNORM : constant := 0; -- *** MISSING: POLLRDBAND *** -- POLLRDBAND : constant := 0; POLLPRI : constant := 2; -- *** MISSING: POLLWRNORM *** -- POLLWRNORM : constant := 0; -- *** MISSING: POLLWRBAND *** -- POLLWRBAND : constant := 0; POLLERR : constant := 8; POLLNVAL : constant := 32; -- *** MISSING: function poll *** -- HAVE_poll : constant Boolean := False; poll_LINKNAME : constant String := "nosys_neg_one"; HAVE_select : constant Boolean := True; select_LINKNAME : constant String := "select"; end POSIX.C; florist-gpl-2017-src/lynxos5/gnatprep.config0000644000076700001450000000106312100062573020433 0ustar gnatmailgnatHAVE_Safe_Errno := True HAVE_IRIX_Timers := False HAVE_Safe_Errno := True HAVE_IRIX_Timers := False -- could not find tli.h TLI := False -- set BSD4_3 to False if using 4.4 style socket msghdr BSD4_3 := False HAVE_Safe_Errno := True HAVE_IRIX_Timers := False -- could not find tli.h TLI := False HAVE_Safe_Errno := True HAVE_IRIX_Timers := False -- could not find tli.h TLI := False HAVE_Safe_Errno := True HAVE_IRIX_Timers := False -- could not find tli.h TLI := False HAVE_Safe_Errno := True HAVE_IRIX_Timers := False -- could not find tli.h TLI := False florist-gpl-2017-src/lynxos5/posix-implementation-ok_signals.ads0000644000076700001450000000403513106553473024446 0ustar gnatmailgnatpackage POSIX.Implementation.OK_Signals is -- OK (Sig) = True iff we can use Sig with sigwait (). OK : constant array (0 .. 64) of Boolean := (False, True, True, True, True, True, True, True, True, False, True, True, True, True, True, True, True, False, True, True, True, True, True, True, False, True, True, True, True, True, True, True, False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True); -- Default_Is_Ignore (Sig) = True iff we need to override the default -- treatment of Sig with a do-nothing handler before we try to -- use sigwait() with it. Default_Is_Ignore : constant array (0 .. 64) of Boolean := (False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, True, True, False, False, True, False, True, False, False, True, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False); -- Default_Is_Stop (Sig) = True iff the default action of Sig -- is to stop the process. Default_Is_Stop : constant array (0 .. 64) of Boolean := (False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, True, False, False, True, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False); end POSIX.Implementation.OK_Signals; florist-gpl-2017-src/lynxos5/posix-options.ads0000644000076700001450000001314013106553473020762 0ustar gnatmailgnat-- DO NOT EDIT THIS FILE. -- It is generated automatically, by program c-posix.c ------------------------------------------------------------------------------ -- -- -- POSIX Ada95 Bindings for Protocol Independent Interfaces (P1003.5c) -- -- -- -- P O S I X . O P T I O N S -- -- -- -- S p e c -- -- -- -- -- -- -- -- This file is a component of FLORIST, an Ada application program -- -- interface for operating system services for use with the GNAT compiler -- -- and the Gnu Ada Runtime Library (GNARL). FLORIST is intended to -- -- conform to the IEEE POSIX Ada standards, 1003.5-1992 and 1003.5b-1993. -- -- It also includes support for Draft 1 of IEEE Project 1003.5c. -- -- -- -- This package specification contains some text extracted from IEEE STD -- -- 1003.5: 1990, Information Technology -- POSIX Ada Language Interfaces -- -- Part 1: Binding for System Application Program Interface, as amended -- -- by IEEE STD 1003.5b: 1996, Amendment 1: Realtime Extensions, copyright -- -- 1996 by the Institute of Electrical and Electronics Engineers, Inc. -- -- -- -- The package specifications in the IEEE standards cited above represent -- -- only a portion of the documents and are not to be interpreteted -- -- outside the context of the documents. The standards must be used in -- -- conjunction with the package specifications in order to claim -- -- conformance. The IEEE takes no responsibility for and will assume no -- -- liability for damages resulting from the reader's misinterpretation of -- -- said information resulting from its out-of-context nature. To order -- -- copies of the IEEE standards, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via phone at -- -- 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- ------------------------------------------------------------------------------ package POSIX.Options is subtype Asynchronous_IO_Support is Boolean range True .. True; subtype Change_Owner_Restriction is POSIX.Change_Owner_Restriction; subtype Filename_Truncation is POSIX.Filename_Truncation; subtype File_Synchronization_Support is Boolean range True .. True; subtype Job_Control_Support is POSIX.Job_Control_Support; subtype Memory_Mapped_Files_Support is Boolean range True .. True; subtype Memory_Locking_Support is Boolean range True .. True; subtype Memory_Range_Locking_Support is Boolean range True .. True; subtype Memory_Protection_Support is Boolean range True .. True; subtype Message_Queues_Support is Boolean range True .. True; subtype Saved_IDs_Support is POSIX.Saved_IDs_Support; subtype Mutexes_Support is Boolean range True .. True; subtype Prioritized_IO_Support is Boolean range True .. True; subtype Priority_Process_Scheduling_Support is Boolean range True .. True; subtype Priority_Task_Scheduling_Support is Boolean range True .. True; subtype Realtime_Signals_Support is Boolean range True .. True; subtype Semaphores_Support is Boolean range True .. True; subtype Shared_Memory_Objects_Support is Boolean range True .. True; subtype Signal_Entries_Support is Boolean range True .. True; subtype Synchronized_IO_Support is Boolean range True .. True; subtype Mutex_Priority_Ceiling_Support is Boolean range True .. True; subtype Mutex_Priority_Inheritance_Support is Boolean range True .. True; subtype Process_Shared_Support is Boolean range True .. True; subtype Timers_Support is Boolean range True .. True; subtype XTI_DNI_Support is Boolean range False .. True; subtype Internet_Datagram_Support is Boolean range False .. True; subtype Internet_Protocol_Support is Boolean range False .. True; subtype Internet_Stream_Support is Boolean range False .. True; subtype ISO_OSI_Protocol_Support is Boolean range False .. True; subtype OSI_Minimal_Support is Boolean range False .. True; subtype OSI_Connection_Support is Boolean range False .. True; subtype OSI_Connectionless_Support is Boolean range False .. True; subtype Poll_Support is Boolean range False .. True; subtype Select_Support is Boolean range False .. True; subtype Sockets_DNI_Support is Boolean range False .. True; subtype Network_Management_Support is Boolean range False .. True; end POSIX.Options; florist-gpl-2017-src/lynxos5/pconfig.h0000644000076700001450000000027413106553473017240 0ustar gnatmailgnat/* file: pconfig.h.in LynxOS version */ #define _POSIX_C_SOURCE 199506L #define _REENTRANT #define _POSIX_C_SIGNALS_C #define _BSD_SOURCE #include #include florist-gpl-2017-src/configure.in0000644000076700001450000002756012442527764016347 0ustar gnatmailgnat# Configure template for Florist # Process this file with autoconf to produce a configure script. # When adding new names (header-files, types, functions, etc.) # to this file, don't forget to also add the corresponding line # for HAVE_... to config.h.in. define([AC_CACHE_LOAD], )dnl define([AC_CACHE_SAVE], )dnl AC_INIT(libsrc/posix.adb) [echo See file "configure.log" for results of this step.] # specifies some well-known file in the configured directory AC_CONFIG_HEADER(confsrc/config.h) AC_PROG_CC rm -f pconfig.h AC_ARG_ENABLE(threads, AS_HELP_STRING([--disable-threads], [Do not try to build pthread support]),, [use_pthread=yes]) if test "x$use_pthread" = "xyes" ; then DEPS=deps SIGNALS_GENERATED=posix-implementation-ok_signals.ads THREADS_BOOL=True else AC_MSG_WARN(No pthread support.) DEPS=deps_no_thread SIGNALS_GENERATED= THREADS_BOOL=False fi THREADS_OPTION=-XTHREADS=${THREADS_BOOL} AC_SUBST(SIGNALS_GENERATED) AC_SUBST(THREADS_OPTION) AC_SUBST(DEPS) AC_MSG_CHECKING([whether to build a shared library]) AC_ARG_ENABLE(shared, AS_HELP_STRING([--enable-shared], [Enable build of shared libraries]), [ AC_MSG_RESULT($enableval) if test "$enableval" = "yes"; then LIBRARY_TYPE_OPTION="-XLIBRARY_TYPE=relocatable" fi ], [AC_MSG_RESULT(no)]) AC_SUBST(LIBRARY_TYPE_OPTION) AC_MSG_CHECKING([build type]) AC_ARG_WITH(build-type, AS_HELP_STRING([--with-build-type=X], [Set build type (Production/Debug)]), [ case "x$with_build_type" in xyes|xno) AC_ERROR([invalid build type]) ;; *) AC_MSG_RESULT($with_build_type) BUILD_TYPE_OPTION="-XBuild=$with_build_type" ;; esac ], [AC_MSG_RESULT(default)]) AC_SUBST(BUILD_TYPE_OPTION) AC_MSG_CHECKING([RTS kind]) AC_ARG_WITH(rts, AS_HELP_STRING([--with-rts=X], [Set RTS]), [ case "x$with_rts" in xyes|xno) AC_ERROR([invalid RTS]) ;; *) AC_MSG_RESULT($with_rts) RTS_OPTION="--RTS=$with_rts" ;; esac ], [AC_MSG_RESULT(default)]) AC_SUBST(RTS_OPTION) [ # By default errno is preserved accross exceptions safe_errno=True echo $ac_n "checking for SGI IRIX timers... " $ac_c; if (grep "CLOCK_SGI_FAST" /usr/include/sys/ptimers.h >/dev/null 2>&1); then echo "yes" echo "HAVE_IRIX_Timers := True" >> gnatprep.config; else echo "no" echo "HAVE_IRIX_Timers := False" >> gnatprep.config; fi; UNAME_MACHINE=`(uname -m) 2>/dev/null` UNAME_RELEASE=`(uname -r) 2>/dev/null` UNAME_SYSTEM=`(uname -s) 2>/dev/null` UNAME_VERSION=`(uname -v) 2>/dev/null` echo ${UNAME_SYSTEM} ${UNAME_MACHINE} ${UNAME_RELEASE} ${UNAME_VERSION} case ${UNAME_SYSTEM} in HP-UX) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; case ${UNAME_RELEASE} in B.10.*) echo "making Config" cp ./configs/pconfig.HP-UX10.x ./pconfig.h.in; ;; B.11.*) echo "making Config" # getenv might be called during propagation, and modifies errno. safe_errno=False cp ./configs/pconfig.HP-UX11.00 ./pconfig.h.in; ;; *) echo "Unexpected HP-UX release; using default." cp ./configs/pconfig.Default ./pconfig.h.in; ;; esac; ;; SunOS) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; case ${UNAME_RELEASE} in 5.1[0-9]) cp ./configs/pconfig.SunOS5.10 ./pconfig.h.in ;; *) cp ./configs/pconfig.SunOS5.6 ./pconfig.h.in ;; esac ;; Linux) # .... need to add cases here for different thread and C libraries echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; cp ./configs/pconfig.Linux ./pconfig.h.in; ;; OSF1) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; case `gcc -dumpmachine` in *-*-osf4.0[bc]) cp ./configs/pconfig.OSF1-4.0b ./pconfig.h.in; ;; *-*-osf4.0[d-z] | *-*-osf4.[1-9]* | *-*-osf5* ) cp ./configs/pconfig.OSF1 ./pconfig.h.in; ;; esac ;; IRIX*) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; cp ./configs/pconfig.IRIX6.x ./pconfig.h.in; ;; AIX) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_VERSION}; case `gcc -dumpmachine` in *-*-aix4*) cp ./configs/pconfig.AIX4.1 ./pconfig.h.in; ;; *-*-aix[567]*) cp ./configs/pconfig.AIX5.x ./pconfig.h.in; ;; esac ;; UnixWare) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; cp ./configs/pconfig.UnixWare ./pconfig.h.in; ;; LynxOS) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; cp ./configs/pconfig.LynxOS ./pconfig.h.in; ;; FreeBSD) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; cp ./configs/pconfig.FreeBSD ./pconfig.h.in; ;; Darwin) echo "Using Configuration for" ${UNAME_SYSTEM} ${UNAME_RELEASE}; cp ./configs/pconfig.Darwin ./pconfig.h.in; ;; *) echo "No Configuration for ${UNAME_SYSTEM}. Using default."; cp ./configs/pconfig.Default ./pconfig.h.in; ;; esac; if test "x$safe_errno" = "xTrue" ; then safe_errno_msg="safe" else safe_errno_msg="not safe" fi echo "We will assume errno is $safe_errno_msg for exception propagation." echo "to override, hand-edit gnatprep.config" echo "HAVE_Safe_Errno := $safe_errno" >> gnatprep.config; ] # defines HAVE_NAME_H for each header "name.h" found # also checks for location of Pthread library # note that the order is rather touchy # for Solaris 2.5.1, utsname.h must precede limits.h # for Solaris 2.5.1, netinet/in.h must preceded arpa/inet.h # for Linux 2.0.x with Provenzano (MIT) threads, # pthread.h must follow sched.h, since # pthread.h redefines symbols in sched.h; # the effect is to detect the problem and drop pthread.h AC_POSIX_HEADERS(\ aio.h\ dirent.h\ errno.h\ fcntl.h\ grp.h\ locale.h\ mqueue.h\ pwd.h\ sched.h\ pthread.h\ semaphore.h\ setjmp.h\ signal.h\ stdio.h\ sys/mman.h\ sys/stat.h\ sys/times.h\ sys/types.h\ sys/utsname.h\ limits.h\ sys/wait.h\ termios.h\ time.h\ sys/time.h\ unistd.h\ utime.h\ ) # POSIX.5c headers are separated, because we want to do # some special processing to try to substitute for missing standard # header files. # Checks for xti.h and tli.h are built-in, as is check for whether we # need addrinfo.h. # We always call this after AC_POSIX_HEADERS, so that pconfig.h will # already have the other required POSIX headers in it, and in particular # will have any lines inherited from pconfig.h.in. AC_POSIX5C_HEADERS( netdb.h\ netinet/in.h\ netinet/in_systm.h\ netinet/ip.h\ netinet/tcp.h\ arpa/inet.h\ poll.h\ sys/select.h\ sys/socket.h\ sys/uio.h\ sys/un.h\ ) if test "x$use_pthread" = "xyes" ; then AC_CHECK_LIB(pthread, pthread_self,, [AC_CHECK_LIB(pthread, __pthread_self,, [AC_CHECK_LIB(pthreads, pthread_self,, [AC_CHECK_LIB(cma, pthread_self,, [AC_CHECK_LIB(:libcma.a, pthread_self,, [AC_CHECK_LIB(thread, pthread_self,, [AC_CHECK_LIB(c_r, pthread_self)])])])])])]) fi AC_CHECK_LIB(aio, aio_read) AC_CHECK_LIB(posix4, clock_gettime,, AC_CHECK_LIB(rt, clock_gettime)) AC_CHECK_LIB(nsl, gethostbyname) AC_CHECK_LIB(nsl, t_bind,, AC_CHECK_LIB(nsl_s, t_bind)) AC_CHECK_LIB(socket, accept) AC_CHECK_LIB(resolv, h_errno) echo "Using LIBS=${LIBS}" AC_SUBST(LIBS) AC_POSIX_VAR(t_errno) AC_POSIX_VAR(t_nerr) AC_POSIX_COMP(msghdr, msg_control) AC_POSIX_COMP(msghdr, msg_controllen) AC_POSIX_COMP(msghdr, msg_flags) AC_POSIX_COMP(sigevent, sigev_notify_function) AC_POSIX_COMP_OVERLAY(sigaction, sa_sigaction, sa_handler) AC_POSIX_STRUCTS(\ addrinfo\ aiocb\ cmsghdr\ dirent\ flock\ group\ hostent\ iovec\ in_addr\ ip_opts\ linger\ msghdr\ mq_attr\ netbuf\ netent\ passwd\ pollfd\ protoent\ tm\ tms\ sched_param\ servent\ sigaction\ cma_sigaction\ sigevent\ sockaddr\ sockaddr_in\ sockaddr_un\ stat\ termios\ timespec\ timeval\ t_bind\ t_call\ t_discon\ t_info\ t_iovec\ t_kpalive\ t_linger\ t_opthdr\ t_optmgmt\ t_uderr\ t_unitdata\ itimerspec\ utimbuf\ utsname\ ) AC_POSIX_TYPES(\ blkcnt_t\ blksize_t\ cc_t\ clockid_t\ clock_t\ dev_t\ fd_set\ ino_t\ in_addr_t\ in_port_t\ mqd_t\ nlink_t\ pthread_attr_t\ pthread_condattr_t\ pthread_cond_t\ pthread_key_t\ pthread_mutexattr_t\ pthread_mutex_t\ pthread_once_t\ pthread_t\ sa_family_t\ sem_t\ siginfo_t\ sigset_t\ sigval\ socklen_t \ speed_t\ suseconds_t\ tcflag_t\ timer_t\ ) AC_POSIX_FUNCS(\ accept\ access\ aio_cancel\ aio_error\ aio_fsync\ aio_read\ aio_return\ aio_suspend\ aio_write\ bind\ cfgetispeed\ cfgetospeed\ cfsetispeed\ cfsetospeed\ chdir\ chmod\ chown\ clock_getres\ clock_gettime\ clock_settime\ close\ closedir\ connect\ ctermid\ ctime\ ctime_r\ dup\ dup2\ endhostent\ endnetent\ endprotoent\ endservent\ execl\ execle\ execlp\ execv\ execve\ execvp\ fchmod\ fcntl\ fdatasync\ fork\ fpathconf\ fstat\ fsync\ ftruncate\ getaddrinfo\ getcwd\ getegid\ getenv\ geteuid\ getgid\ getgrgid\ getgrgid_r\ getgrnam\ getgrnam_r\ getgroups\ gethostbyaddr\ gethostbyaddr_r\ gethostbyname\ gethostbyname_r\ gethostname\ getlogin\ getlogin_r\ getpeername\ getpgrp\ getpid\ getppid\ getnetbyaddr\ getnetbyaddr_r\ getnetbyname\ getnetbyname_r\ getprotobyname\ getprotobyname_r\ getprotobynumber\ getprotobynumber_r\ getservbyname\ getservbyname_r\ getpwnam\ getpwnam_r\ getpwuid\ getpwuid_r\ getservbyport\ getservbyport_r\ getsockname\ getsockname_r\ getsockopt\ gettimeofday\ getuid\ gmtime_r\ inet_addr\ inet_lnaof\ inet_makeaddr\ inet_network\ inet_ntoa\ inet_netof\ isatty\ isfdtype\ kill\ link\ lio_listio\ listen\ lseek\ lstat\ mkdir\ mkfifo\ mlock\ mlockall\ mmap\ mprotect\ mq_close\ mq_getattr\ mq_notify\ mq_open\ mq_receive\ mq_send\ mq_setattr\ mq_unlink\ msync\ munlock\ munlockall\ munmap\ open\ opendir\ pathconf\ pipe\ poll\ pthread_condattr_destroy\ pthread_condattr_getpshared\ pthread_condattr_init\ pthread_condattr_setpshared\ pthread_cond_broadcast\ pthread_cond_destroy\ pthread_cond_init\ pthread_cond_signal\ pthread_cond_timedwait\ pthread_cond_wait\ pthread_mutexattr_destroy\ pthread_mutexattr_getprioceiling\ pthread_mutexattr_getprotocol\ pthread_mutexattr_getpshared\ pthread_mutexattr_init\ pthread_mutexattr_setprioceiling\ pthread_mutexattr_setprotocol\ pthread_mutexattr_setpshared\ pthread_mutex_destroy\ pthread_mutex_getprioceiling\ pthread_mutex_init\ pthread_mutex_lock\ pthread_mutex_setprioceiling\ pthread_mutex_trylock\ pthread_mutex_unlock\ pthread_sigmask\ putenv\ rcvmsg\ read\ readdir\ readdir_r\ recv\ recvfrom\ recvmsg\ rename\ rand_r\ rmdir\ sched_getparam\ sched_getscheduler\ sched_get_priority_max\ sched_get_priority_min\ sched_rr_get_interval\ sched_setparam\ sched_setscheduler\ sched_yield\ select\ sem_close\ sem_destroy\ sem_getvalue\ sem_init\ sem_open\ sem_post\ sem_trywait\ sem_unlink\ sem_wait\ send\ sendto\ sendmsg\ setgid\ setenv\ sethostent\ setnetent\ setpgid\ setprotoent\ setservent\ setsid\ setsockopt\ setuid\ shm_open\ shm_unlink\ shutdown\ sigaction\ sigaddset\ sigdelset\ sigemptyset\ sigfillset\ sigismember\ siglongjmp\ sigpending\ sigprocmask\ sigqueue\ sigsetjmp\ sigsuspend\ sigtimedwait\ sigwait\ sigwaitinfo\ socket\ sockatmark\ socketpair\ stat\ strtok_r\ sysconf\ tcdrain\ tcflow\ tcflush\ tcgetattr\ tcgetpgrp\ tcsendbreak\ tcsetattr\ tcsetpgrp\ time\ timer_create\ timer_delete\ timer_getoverrun\ timer_gettime\ timer_settime\ times\ ttyname\ ttyname_r\ t_accept\ t_alloc\ t_bind\ t_blocking\ t_close\ t_connect\ t_error\ t_free\ t_getinfo\ t_getprotaddr\ t_getstate\ t_listen\ t_look\ t_nonblocking\ t_open\ t_optmgmt\ t_rcv\ t_rcvconnect\ t_rcvdis\ t_rcvrel\ t_rcvudata\ t_snd\ t_snddis\ t_sndudata\ t_strerror\ t_sync\ t_unbind\ t_rcvreldata\ t_rcvuderr\ t_rcvv\ t_rcvvudata\ t_sndreldata\ t_sndrel\ t_sndv\ t_sndvudata\ umask\ uname\ unlink\ unsetenv\ utime\ waitpid\ write\ __posix_sigwait\ __posix_ctime_r\ __posix_readdir_r\ __posix_sigwait_r\ __posix_ttyname_r\ ) AC_OUTPUT(Makefile, [test -z "$CONFIG_HEADERS" || date > stamp-h]) florist-gpl-2017-src/configs/0000755000076700001450000000000013106553470015443 5ustar gnatmailgnatflorist-gpl-2017-src/configs/pconfig.Linux0000644000076700001450000000030412301704411020073 0ustar gnatmailgnat/* file: pconfig.h.in Linux version */ #define _POSIX_C_SOURCE 199506L #define _REENTRANT #define _POSIX_C_SIGNALS_C #define _BSD_SOURCE #define _FILE_OFFSET_BITS 64 #define _XOPEN_SOURCE 600 florist-gpl-2017-src/configs/pconfig.AIX5.x0000644000076700001450000000020110676765703017774 0ustar gnatmailgnat/* pthread.h must be included before errno.h to ensure the _THREAD_SAFE has been defined correctly. */ #include florist-gpl-2017-src/configs/pconfig.HP-UX11.000000644000076700001450000000056210416500352020226 0ustar gnatmailgnat#define _XOPEN_SOURCE_EXTENDED #define _INCLUDE_HPUX_SOURCE #define _REENTRANT /* Need those defines, but sys/semaphore.h will only define them if _KERNEL_BUILD is set */ #define NSDCHUNKS 16 #define SSDCHUNK 16 #ifdef __ia64__ #define XTI_TINFO_FTYPE int #define XTI_OPTHDR_FTYPE int #define XTI_LINGER_FTYPE int #define XTI_KPALIVE_FTYPE int #endif /* __ia64__ */ florist-gpl-2017-src/configs/pconfig.Default0000644000076700001450000000015206602140742020371 0ustar gnatmailgnat#define _POSIX_C_SOURCE 199506L #define _XOPEN_SOURCE #define _XOPEN_SOURCE_EXTENDED 1 #define _REENTRANT florist-gpl-2017-src/configs/pconfig.FreeBSD0000644000076700001450000000014410106411407020211 0ustar gnatmailgnat#define _XOPEN_SOURCE #define _XOPEN_SOURCE_EXTENDED 1 #define _REENTRANT #define _P1003_1B_VISIBLE florist-gpl-2017-src/configs/pconfig.UnixWare0000644000076700001450000000026107201541267020553 0ustar gnatmailgnat#define _POSIX_C_SOURCE 199506L #define _XOPEN_SOURCE #define _XOPEN_SOURCE_EXTENDED 1 #define _REENTRANT #define __VA_LIST #define si_value _data typedef unsigned long u_long; florist-gpl-2017-src/configs/pconfig.OSF10000644000076700001450000000023506604407653017530 0ustar gnatmailgnat#define _POSIX_C_SOURCE 199506L #define _REENTRANT #define _XOPEN_SOURCE #define _XOPEN_SOURCE_EXTENDED 1 #define _OSF_SOURCE #define sigcontext _sigcontext florist-gpl-2017-src/configs/pconfig.IRIX6.x0000644000076700001450000000023507077713601020125 0ustar gnatmailgnat#include #include #define _POSIX_C_SOURCE 199506L #define _REENTRANT #define _XOPEN_SOURCE #define _XOPEN_SOURCE_EXTENDED 1 florist-gpl-2017-src/configs/pconfig.Darwin0000644000076700001450000000014410345111571020227 0ustar gnatmailgnat#define _XOPEN_SOURCE #define _XOPEN_SOURCE_EXTENDED 1 #define _REENTRANT #define _P1003_1B_VISIBLE florist-gpl-2017-src/configs/pconfig.SunOS5.100000644000076700001450000000167012010475662020330 0ustar gnatmailgnat#define _POSIX_C_SOURCE 199506L #define _XOPEN_SOURCE 500 #define _XOPEN_SOURCE_EXTENDED 1 #define __EXTENSIONS__ #define _REENTRANT #define _LARGEFILE_SOURCE #define _FILE_OFFSET_BITS 64 /* SOLARIS_HACK activates a workaround for a trick that appeared in the Solaris 2.6 header files, of defining local function bodies for certain POSIX function names, which are wrappers that in turn call a real library function whose name is of the form __posix_XXX. ....We need to fix the configuration process to auto-detect this! */ #define SOLARIS_HACK /* Need to include stdarg.h first to ensure that the GNU stdarg will be used. Defining _VA_LIST ensures that no further definition of va_list will be attempted. */ #include #define _VA_LIST #ifdef __arch64__ #define XTI_TINFO_FTYPE int #define XTI_OPTHDR_FTYPE int #define XTI_LINGER_FTYPE int #define XTI_KPALIVE_FTYPE int #endif /* __arch64__ */ #define __solaris10__ florist-gpl-2017-src/configs/pconfig.SunOS5.60000644000076700001450000000164112012142535020243 0ustar gnatmailgnat#define _POSIX_C_SOURCE 199506L #define _XOPEN_SOURCE 500 #define _XOPEN_SOURCE_EXTENDED 1 #define __EXTENSIONS__ #define _REENTRANT #define _LARGEFILE_SOURCE #define _FILE_OFFSET_BITS 64 /* SOLARIS_HACK activates a workaround for a trick that appeared in the Solaris 2.6 header files, of defining local function bodies for certain POSIX function names, which are wrappers that in turn call a real library function whose name is of the form __posix_XXX. ....We need to fix the configuration process to auto-detect this! */ #define SOLARIS_HACK /* Need to include stdarg.h first to ensure that the GNU stdarg will be used. Defining _VA_LIST ensures that no further definition of va_list will be attempted. */ #include #define _VA_LIST #ifdef __arch64__ #define XTI_TINFO_FTYPE int #define XTI_OPTHDR_FTYPE int #define XTI_LINGER_FTYPE int #define XTI_KPALIVE_FTYPE int #endif /* __arch64__ */ florist-gpl-2017-src/configs/pconfig.HP-UX10.x0000644000076700001450000000043107110540406020251 0ustar gnatmailgnat#define _XOPEN_SOURCE_EXTENDED #define _INCLUDE_HPUX_SOURCE #define _REENTRANT /* For HP-UX with DCE threads, we need pthread.h first, to get the desired effect, in the presence of #define sigaction cma_sigaction. */ #include #define pthread_sigmask sigprocmask florist-gpl-2017-src/configs/pconfig.OSF1-4.0b0000644000076700001450000000026606604407653020175 0ustar gnatmailgnat#define _POSIX_C_SOURCE 199506L #define _REENTRANT #define _XOPEN_SOURCE #define _XOPEN_SOURCE_EXTENDED 1 #define _OSF_SOURCE #define sigcontext _sigcontext #define _PTHREAD_ENV_CXX florist-gpl-2017-src/configs/pconfig.AIX4.10000644000076700001450000000173310321321461017647 0ustar gnatmailgnat/* ??? On AiX, pthread.h must be included first */ #ifdef _POSIX_C_SIGNALS_C #ifndef _LONG_LONG #define _LONG_LONG #include #endif #endif #define _POSIX_C_SOURCE 199506L #define _POSIX_SOURCE #define _XOPEN_EXTENDED_SOURCE #define _SC_PAGE_SIZE 48 #define _SC_PAGESIZE _SC_PAGE_SIZE #define _REENTRANT #define pthread_sigmask sigthreadmask typedef unsigned char sa_family_t; #define aio_sigevent aio_event /* ??? There is an additional structure on AIX (struct liocb) to handle these fields. For now, fake them. */ #define aio_fildes aio_whence #define aio_lio_opcode aio_flag /* typedefs for BSD unsigned things ??? These are defined in when _ALL_SOURCE is defined, but that cause troubles in other parts of Florist */ typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; typedef long long int64_t; typedef unsigned long long uint64_t; florist-gpl-2017-src/configs/pconfig.LynxOS0000644000076700001450000000246607421137472020221 0ustar gnatmailgnat/* Begin pconfig.LynxOS */ #define _POSIX_C_SOURCE 199506L #define _REENTRANT #define _XOPEN_SOURCE #define _XOPEN_SOURCE_EXTENDED 1 /* Work around header file problems: These should be addressed by the configure script, but for the time being the following directives explicitly include and tag undetected but available declarations. */ /* socket.h related. */ #include #define sa_family_t unsigned char #define HAVE_sa_family_t 1 /* Required for AF_UNIX domain sockets: The sockaddr_un structure is not defined in or included by socket.h. */ #include #define HAVE_sockaddr_un 1 /* signal.p4.h related */ #define HAVE_sigset_t 1 #define HAVE_sigval 1 #define HAVE_siginfo_t 1 /* types.h related. */ #define HAVE_fd_set 1 /* termio.h / termios.h related. */ #define HAVE_cc_t 1 #define HAVE_tcflag_t 1 #define HAVE_speed_t 1 /* The LynxOS BSD interfaces are closer to version 4.4 than to 4.3. */ #ifdef _BSD4_3_ #undef _BSD4_3_ #endif /* _BSD4_3_ */ #ifndef _BSD4_4_ #define _BSD4_4_ #endif /* _BSD4_4_ */ /* Work around for SIGTHREADKILL issues: LynxOS reserves signal 24 (aka SIGUDEF24) to the user space-portion of the pthreads implementation. */ #define LYNX_SIGTHREADKILL_HACK #define SIGTHREADKILL 24 /* End pconfig.LynxOS */ florist-gpl-2017-src/addrinfo.h0000644000076700001450000000352613106553473015763 0ustar gnatmailgnat#if ! defined (__addrinfo_h) && ! defined (AI_PASSIVE) #define __addrinfo_h /* * Everything here really belongs in . * These defines are separate for now, to avoid having to modify the * system's header. * The test for AI_PASSIVE in the first line will prevent compilation * of this file on any system where these defines ARE included in * , e.g. Solaris 2.8 */ struct addrinfo { int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ int ai_family; /* PF_xxx */ int ai_socktype; /* SOCK_xxx */ int ai_protocol; /* IPPROTO_xxx for IPv4 and IPv6 */ size_t ai_addrlen; /* length of ai_addr */ char *ai_canonname; /* canonical name for host */ struct sockaddr *ai_addr; /* binary address */ struct addrinfo *ai_next; /* next structure in linked list */ }; #define AI_PASSIVE 1 /* socket is intended for bind() + listen() */ #define AI_CANONNAME 2 /* return canonical name */ #define EAI_ADDRFAMILY 1 /* address family for host not supported */ #define EAI_AGAIN 2 /* temporary failure in name resolution */ #define EAI_BADFLAGS 3 /* invalid value for ai_flags */ #define EAI_FAIL 4 /* non-recoverable failure in name resolution */ #define EAI_FAMILY 5 /* ai_family not supported */ #define EAI_MEMORY 6 /* memory allocation failure */ #define EAI_NODATA 7 /* no address associated with host */ #define EAI_NONAME 8 /* host nor service provided, or not known */ #define EAI_SERVICE 9 /* service not supported for ai_socktype */ #define EAI_SOCKTYPE 10 /* ai_socktype not supported */ #define EAI_SYSTEM 11 /* system error returned in errno */ /* function prototypes */ int getaddrinfo(const char *, const char *, const struct addrinfo *, struct addrinfo **); void freeaddrinfo(struct addrinfo *); int getnameinfo(const struct sockaddr *, size_t, char *, size_t, char *, size_t); #endif /* __addrinfo_h */ florist-gpl-2017-src/florist.gpr0000644000076700001450000000276213106553472016220 0ustar gnatmailgnatlibrary project Florist is for Library_Name use "florist"; for Languages use ("C", "Ada"); type Boolean is ("False", "True"); Threads : Boolean := external ("THREADS", "True"); Common_Source_Dirs := ("libsrc", "gensrc", "confsrc"); Threads_Source_Dirs := ("libsrc/threads", "gensrc/threads"); case Threads is when "False" => for Source_Dirs use Common_Source_Dirs; when "True" => for Source_Dirs use Common_Source_Dirs & Threads_Source_Dirs; end case; for Object_Dir use "obj"; for Library_Dir use "lib"; Version := "1"; for Library_version use "libflorist.so." & Version; type Library_Type_Type is ("relocatable", "static"); Library_Type : Library_Type_Type := external ("LIBRARY_TYPE", "static"); for Library_Kind use Library_Type; type Build_Type is ("Debug", "Production"); Build : Build_Type := External ("Build", "Production"); package Compiler is GNAT_Flags := ("-O2", "-gnatpg"); for Switches ("posix-signals.adb") use GNAT_Flags; for Switches ("posix-implementation.adb") use GNAT_Flags; for Switches ("posix-supplement_to_ada_io.adb") use GNAT_Flags; for Switches ("posix-unsafe_process_primitives.adb") use GNAT_Flags; case Build is when "Debug" => for Default_Switches ("Ada") use ("-O2", "-gnatwae", "-gnatyg"); when "Production" => for Default_Switches ("Ada") use ("-O2", "-gnatp"); end case; end Compiler; end Florist; florist-gpl-2017-src/README0000644000076700001450000000117510430124174014667 0ustar gnatmailgnatFLORIST: This directory contains the components of FLORIST, an implementation of the IEEE Standards 1003.5: 1992, IEEE STD 1003.5b: 1996, and parts of IEEE STD 1003.5c: 1998, also known as the POSIX Ada Bindings. NORMAL INSTALLATION: Follow the steps described in the INSTALL file. COMPILING YOUR PROGRAMS WITH FLORIST: To compile your own programs with Florist, you will need to add a "with florist" in your project file. florist.gpr can be found under prefix/lib/gnat is also sufficient. Alternatively, to use Florist without project files, you can also do something like: $ gnatmake -I/prefix/floristlib main -largs -lflorist florist-gpl-2017-src/confsrc/0000755000076700001450000000000013106553470015450 5ustar gnatmailgnatflorist-gpl-2017-src/confsrc/config.h.in0000644000076700001450000002301712414726572017504 0ustar gnatmailgnat/* When adding new names (header-files, types, functions, etc.) to this file, don't forget to also add the corresponding names to configure.in. There are some non-POSIX names here, that we have learned by experience are defined on certain systems and may be used in place of the proper POSIX names. In particular, the names of the form __posix_XXX are not real POSIX names, but rather are stand-ins for the proper POSIX function XXX, specific to Solaris 2.6. I apologize for this ugly hack. Suggestions for a cleaner workaround would be welcome (see related comment on SOLARIS in the file README). */ /* header files */ #undef HAVE_DIRENT_H /* functions */ #undef HAVE_accept #undef HAVE_access #undef HAVE_aio_cancel #undef HAVE_aio_error #undef HAVE_aio_fsync #undef HAVE_aio_read #undef HAVE_aio_return #undef HAVE_aio_suspend #undef HAVE_aio_write #undef HAVE_bind #undef HAVE_cfgetispeed #undef HAVE_cfgetospeed #undef HAVE_cfsetispeed #undef HAVE_cfsetospeed #undef HAVE_chdir #undef HAVE_chmod #undef HAVE_chown #undef HAVE_clock_getres #undef HAVE_clock_gettime #undef HAVE_clock_settime #undef HAVE_close #undef HAVE_closedir #undef HAVE_connect #undef HAVE_ctermid #undef HAVE_ctime #undef HAVE_ctime_r #undef HAVE_dup #undef HAVE_dup2 /* not referenced: 1 */ #undef HAVE_endhostent #undef HAVE_endnetent #undef HAVE_endprotoent /* not referenced: 1 */ #undef HAVE_endservent #undef HAVE_execl #undef HAVE_execle #undef HAVE_execlp #undef HAVE_execv #undef HAVE_execve #undef HAVE_execvp #undef HAVE_fchmod #undef HAVE_fcntl #undef HAVE_fdatasync #undef HAVE_fork #undef HAVE_fpathconf #undef HAVE_fstat #undef HAVE_fsync #undef HAVE_ftruncate #undef HAVE_getaddrinfo #undef HAVE_getcwd #undef HAVE_getegid #undef HAVE_getenv #undef HAVE_geteuid #undef HAVE_getgid /* not referenced: 2 */ #undef HAVE_getgrgid #undef HAVE_getgrgid_r /* not referenced: 2 */ #undef HAVE_getgrnam #undef HAVE_getgrnam_r #undef HAVE_getgroups /* not referenced: 5 */ #undef HAVE_gethostbyaddr #undef HAVE_gethostbyaddr_r #undef HAVE_gethostbyname #undef HAVE_gethostbyname_r #undef HAVE_gethostname #undef HAVE_getlogin #undef HAVE_getlogin_r #undef HAVE_getnetbyaddr_r #undef HAVE_getnetbyname_r /* not referenced: 2 */ #undef HAVE_getnetbyaddr #undef HAVE_getnetbyname #undef HAVE_getpeername #undef HAVE_getpgrp #undef HAVE_getpid #undef HAVE_getppid #undef HAVE_getprotobyname_r #undef HAVE_getprotobynumber_r /* not referenced: 2 */ #undef HAVE_getprotobyname #undef HAVE_getprotobynumber #undef HAVE_getpwnam #undef HAVE_getpwnam_r #undef HAVE_getpwuid /* unreferenced: 4 */ #undef HAVE_getservbyname #undef HAVE_getservbyname_r #undef HAVE_getservbyport #undef HAVE_getservbyport_r #undef HAVE_getsockname #undef HAVE_getsockopt #undef HAVE_gettimeofday #undef HAVE_getuid /* unreferenced: 1 */ #undef HAVE_gmtime_r /* not referenced: 5 */ #undef HAVE_inet_addr #undef HAVE_inet_lnaof #undef HAVE_inet_makeaddr #undef HAVE_inet_netof #undef HAVE_inet_network #undef HAVE_inet_ntoa #undef HAVE_isatty /* not referenced: 1 */ #undef HAVE_isfdtype #undef HAVE_kill #undef HAVE_link #undef HAVE_lio_listio #undef HAVE_listen #undef HAVE_lseek #undef HAVE_lstat #undef HAVE_mkdir #undef HAVE_mkfifo #undef HAVE_mlock #undef HAVE_mlockall #undef HAVE_mmap #undef HAVE_mprotect #undef HAVE_mq_close #undef HAVE_mq_getattr #undef HAVE_mq_notify #undef HAVE_mq_open #undef HAVE_mq_receive #undef HAVE_mq_send #undef HAVE_mq_setattr #undef HAVE_mq_unlink #undef HAVE_msync #undef HAVE_munlock #undef HAVE_munlockall #undef HAVE_munmap #undef HAVE_open #undef HAVE_opendir #undef HAVE_pathconf #undef HAVE_pipe #undef HAVE_poll #undef HAVE_pthread_cond_broadcast #undef HAVE_pthread_cond_destroy #undef HAVE_pthread_cond_init #undef HAVE_pthread_cond_signal #undef HAVE_pthread_cond_timedwait #undef HAVE_pthread_cond_wait #undef HAVE_pthread_condattr_destroy #undef HAVE_pthread_condattr_getpshared #undef HAVE_pthread_condattr_init #undef HAVE_pthread_condattr_setpshared #undef HAVE_pthread_mutex_destroy #undef HAVE_pthread_mutex_getprioceiling #undef HAVE_pthread_mutex_init #undef HAVE_pthread_mutex_lock #undef HAVE_pthread_mutex_setprioceiling #undef HAVE_pthread_mutex_trylock #undef HAVE_pthread_mutex_unlock #undef HAVE_pthread_mutexattr_destroy #undef HAVE_pthread_mutexattr_getprioceiling #undef HAVE_pthread_mutexattr_getprotocol #undef HAVE_pthread_mutexattr_getpshared #undef HAVE_pthread_mutexattr_init #undef HAVE_pthread_mutexattr_setprioceiling #undef HAVE_pthread_mutexattr_setprotocol #undef HAVE_pthread_mutexattr_setpshared #undef HAVE_pthread_sigmask #undef HAVE_putenv #undef HAVE_read #undef HAVE_readdir /* not referenced: 1 */ #undef HAVE_readdir_r #undef HAVE_recv #undef HAVE_recvfrom #undef HAVE_recvmsg #undef HAVE_rename #undef HAVE_rmdir #undef HAVE_sched_get_priority_max #undef HAVE_sched_get_priority_min #undef HAVE_sched_getparam #undef HAVE_sched_getscheduler #undef HAVE_sched_rr_get_interval #undef HAVE_sched_setparam #undef HAVE_sched_setscheduler #undef HAVE_sched_yield #undef HAVE_select #undef HAVE_sem_close #undef HAVE_sem_destroy #undef HAVE_sem_getvalue #undef HAVE_sem_init #undef HAVE_sem_open #undef HAVE_sem_post #undef HAVE_sem_trywait #undef HAVE_sem_unlink #undef HAVE_sem_wait #undef HAVE_send #undef HAVE_sendmsg #undef HAVE_sendto #undef HAVE_setenv #undef HAVE_setgid /* not referenced: 1 */ #undef HAVE_sethostent #undef HAVE_setnetent #undef HAVE_setpgid #undef HAVE_setprotoent /* not referenced: 1 */ #undef HAVE_setservent #undef HAVE_setsid #undef HAVE_setsockopt #undef HAVE_setuid #undef HAVE_shm_open #undef HAVE_shm_unlink #undef HAVE_shutdown #undef HAVE_sigaction #undef HAVE_sigaddset #undef HAVE_sigdelset #undef HAVE_sigemptyset #undef HAVE_sigfillset #undef HAVE_sigismember #undef HAVE_sigpending #undef HAVE_sigprocmask #undef HAVE_sigqueue #undef HAVE_sigtimedwait #undef HAVE_sigwait #undef HAVE_sigwaitinfo #undef HAVE_sockatmark #undef HAVE_socket #undef HAVE_socketpair #undef HAVE_stat #undef HAVE_sysconf #undef HAVE_t_accept /* not referenced: 1 */ #undef HAVE_t_alloc #undef HAVE_t_bind /* not referenced: 1 */ #undef HAVE_t_blocking #undef HAVE_t_close #undef HAVE_t_connect #undef HAVE_t_error #undef HAVE_t_free #undef HAVE_t_getinfo #undef HAVE_t_getprotaddr #undef HAVE_t_getstate #undef HAVE_t_listen #undef HAVE_t_look /* not referenced: 1 */ #undef HAVE_t_nonblocking #undef HAVE_t_open #undef HAVE_t_optmgmt #undef HAVE_t_rcv #undef HAVE_t_rcvconnect #undef HAVE_t_rcvdis #undef HAVE_t_rcvrel #undef HAVE_t_rcvreldata #undef HAVE_t_rcvudata #undef HAVE_t_rcvuderr #undef HAVE_t_rcvv #undef HAVE_t_rcvvudata #undef HAVE_t_snd #undef HAVE_t_snddis #undef HAVE_t_sndrel #undef HAVE_t_sndreldata #undef HAVE_t_sndudata #undef HAVE_t_sndv #undef HAVE_t_sndvudata #undef HAVE_t_strerror #undef HAVE_t_sync #undef HAVE_t_unbind #undef HAVE_tcdrain #undef HAVE_tcflow #undef HAVE_tcflush #undef HAVE_tcgetattr #undef HAVE_tcgetpgrp #undef HAVE_tcsendbreak #undef HAVE_tcsetattr #undef HAVE_tcsetpgrp #undef HAVE_time #undef HAVE_timer_create #undef HAVE_timer_delete #undef HAVE_timer_getoverrun #undef HAVE_timer_gettime #undef HAVE_timer_settime #undef HAVE_times #undef HAVE_ttyname /* not referenced: 1 */ #undef HAVE_ttyname_r #undef HAVE_umask #undef HAVE_uname #undef HAVE_unlink #undef HAVE_unsetenv #undef HAVE_utime #undef HAVE_waitpid #undef HAVE_write /* SOLARIS hacks */ #undef HAVE___posix_ctime_r #undef HAVE___posix_readdir_r #undef HAVE___posix_sigwait #undef HAVE___posix_ttyname_r /* types */ #undef HAVE_cc_t #undef HAVE_clockid_t #undef HAVE_clock_t #undef HAVE_dev_t #undef HAVE_fd_set #undef HAVE_in_addr_t #undef HAVE_in_port_t #undef HAVE_inet_netof #undef HAVE_ino_t #undef HAVE_mqd_t #undef HAVE_nlink_t #undef HAVE_pthread_attr_t #undef HAVE_pthread_cond_t #undef HAVE_pthread_condattr_t #undef HAVE_pthread_key_t #undef HAVE_pthread_mutex_t #undef HAVE_pthread_mutexattr_t #undef HAVE_pthread_once_t #undef HAVE_pthread_t #undef HAVE_sa_family_t #undef HAVE_sem_t #undef HAVE_siginfo_t #undef HAVE_sigset_t #undef HAVE_sigval #undef HAVE_socklen_t #undef HAVE_speed_t #undef HAVE_suseconds_t #undef HAVE_tcflag_t #undef HAVE_timer_t /* error return macros or variables */ #undef HAVE_t_errno #undef HAVE_t_nerr /* struct types */ #undef HAVE_struct_addrinfo #undef HAVE_struct_aiocb #undef HAVE_struct_cmsghdr #undef HAVE_struct_dirent #undef HAVE_struct_flock #undef HAVE_struct_group #undef HAVE_struct_hostent #undef HAVE_struct_itimerspec #undef HAVE_struct_in_addr #undef HAVE_struct_ip_opts #undef HAVE_struct_iovec #undef HAVE_struct_linger #undef HAVE_struct_msghdr #undef HAVE_struct_mq_attr #undef HAVE_struct_netbuf #undef HAVE_struct_netent #undef HAVE_struct_passwd #undef HAVE_struct_pollfd #undef HAVE_struct_protoent #undef HAVE_struct_sched_param #undef HAVE_struct_servent #undef HAVE_struct_sigaction #undef HAVE_struct_cma_sigaction #undef HAVE_struct_sigevent #undef HAVE_struct_sockaddr #undef HAVE_struct_sockaddr_in #undef HAVE_struct_sockaddr_un #undef HAVE_struct_stat #undef HAVE_struct_termios #undef HAVE_struct_timespec #undef HAVE_struct_timeval #undef HAVE_struct_tm #undef HAVE_struct_tms #undef HAVE_struct_t_bind #undef HAVE_struct_t_call #undef HAVE_struct_t_discon #undef HAVE_struct_t_info #undef HAVE_struct_t_iovec #undef HAVE_struct_t_kpalive #undef HAVE_struct_t_linger #undef HAVE_struct_t_opthdr #undef HAVE_struct_t_optmgmt #undef HAVE_struct_t_uderr #undef HAVE_struct_t_unitdata #undef HAVE_struct_utimbuf #undef HAVE_struct_utsname #undef HAVE_component_sa_sigaction #undef HAVE_component_sigev_notify_function #undef HAVE_component_msg_control #undef HAVE_component_msg_controllen #undef HAVE_component_msg_flags florist-gpl-2017-src/aclocal.m40000644000076700001450000001654012414726572015667 0ustar gnatmailgnatdnl auto-configuration macros for Florist dnl This version requires autoconf-2.10. dnl AC_POSIX_HEADER(HEADER-FILE, dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl side-effect: extend file "pconfig.h", dnl with includes for this header, if present. AC_DEFUN(AC_POSIX_HEADER, [dnl Do the transliteration at runtime so arg 1 can be a shell variable. ac_old_cflags=$CFLAGS # CFLAGS="$CFLAGS -Werror" ac_safe=`echo "$1" | tr './\055' '___'` AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(ac_cv_header_$ac_safe, [AC_TRY_CPP([#include <$1>], AC_TRY_COMPILE([#include "confsrc/pconfig.h" #include <$1>],, eval "ac_cv_header_$ac_safe=yes", eval "ac_cv_header_$ac_safe=no"), eval "ac_cv_header_$ac_safe=no")])dnl if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then AC_MSG_RESULT(yes) echo "#include <$1>" >> confsrc/pconfig.h ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) ifelse([$3], , , [$3 ])dnl fi CFLAGS=$ac_old_cflags ])dnl dnl AC_POSIX_HEADERS(NAMES...) dnl side-effect: create file "pconfig.h" containing includes dnl for all the headers that are present. AC_DEFUN(AC_POSIX_HEADERS, [rm -f confsrc/pconfig.h cp pconfig.h.in confsrc/pconfig.h chmod 644 confsrc/pconfig.h if ( test ! -f confsrc/pconfig.h ) then AC_MSG_ERROR(missing confsrc/pconfig.h); fi for ac_hdr in $1 do AC_POSIX_HEADER($ac_hdr, [ac_tr_hdr=HAVE_$(echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___') AC_DEFINE_UNQUOTED($ac_tr_hdr)])dnl done ])dnl dnl AC_POSIX5C_HEADERS(NAMES...) dnl side-effect: create file "pconfig.h" containing includes dnl for all the headers that are present. AC_DEFUN(AC_POSIX5C_HEADERS, [for ac_hdr in $1 do AC_POSIX_HEADER($ac_hdr, [ac_tr_hdr=HAVE_$(echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___') AC_DEFINE_UNQUOTED($ac_tr_hdr)])dnl done AC_POSIX_HEADER(xti.h, AC_DEFINE_UNQUOTED(HAVE_XTI_H) [ echo "-- don't want TLI because we have xti.h TLI := False" >> gnatprep.config;], AC_POSIX_HEADER(tli.h, AC_DEFINE_UNQUOTED(HAVE_TLI_H) [ echo "-- using TLI because could not find xti.h TLI := True" >> gnatprep.config;], [ echo "-- could not find tli.h TLI := False" >> gnatprep.config;], )) AC_TRY_COMPILE([#include "confsrc/pconfig.h"], [ struct msghdr hdr; hdr.msg_controllen = 0;], [echo "Socket interface looks like BSD 4.4"; # Put BSD flag in gnatprep.config if (grep BSD4_3 gnatprep.config >/dev/null 2>&1); then true; else (echo "-- set BSD4_3 to False if using 4.4 style socket msghdr"; echo "BSD4_3 := False") >> gnatprep.config; fi; if (grep _BSD4_4_ confsrc/pconfig.h >/dev/null 2>&1); then true; else echo "#define _BSD4_4_" >> confsrc/pconfig.h; fi;], [echo "Socket interface Looks like BSD 4.3"; if (grep BSD4_3 gnatprep.config >/dev/null 2>&1); then true; else (echo "-- set BSD4_3 to False if using 4.4 style socket msghdr"; echo "BSD4_3 := True") >> gnatprep.config; fi; if (grep _BSD4_3_ confsrc/pconfig.h >/dev/null 2>&1); then true; else echo "#define _BSD4_3_" >> confsrc/pconfig.h; fi;]) [if (grep xti.h confsrc/pconfig.h >/dev/null 2>&1); then if (grep _XTI_ confsrc/pconfig.h >/dev/null 2>&1); then true; else echo "#define _XTI_" >> confsrc/pconfig.h; fi ; else if [ -f /usr/include/sys/tiuser.h ]; then echo "Have only TLI, will use that in place of XTI"; if (grep _TLI_ confsrc/pconfig.h >/dev/null 2>&1); then true; else echo "#define _TLI_" >> confsrc/pconfig.h; echo "#include " >> confsrc/pconfig.h; fi; fi; fi] dnl For some reason the line below cannot be removed??? dnl AC_CHECK_FUNC(getaddrinfo, [], []) ])dnl dnl AC_POSIX_LIBS(LIBRARY..., FUNCTION dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) AC_DEFUN(AC_POSIX_LIBS, [for ac_lib in $1 do AC_POSIX_LIB($ac_lib,$2,ac_lib_success="yes",ac_lib_success="no") if [[ "$ac_lib_success" = "yes" ]] then break; fi done]) dnl AC_POSIX_TYPE(TYPE-NAME) AC_DEFUN(AC_POSIX_TYPE, [AC_REQUIRE([AC_POSIX_HEADERS])dnl AC_MSG_CHECKING(for $1) AC_CACHE_VAL(ac_cv_type_$1, AC_EGREP_CPP($1[[[^0-9A-Za-z_]]],[#include "confsrc/pconfig.h"], eval "ac_cv_type_$1=yes", eval "ac_cv_type_$1=no")) if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then AC_DEFINE_UNQUOTED(HAVE_$1) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi ]) dnl AC_POSIX_TYPES(TYPE-NAME...) AC_DEFUN(AC_POSIX_TYPES, [for ac_typ in $1 do AC_POSIX_TYPE($ac_typ) done ]) dnl AC_POSIX_CONST(CONST) AC_DEFUN(AC_POSIX_CONST, [AC_REQUIRE([AC_POSIX_HEADERS])dnl AC_MSG_CHECKING(for $1) AC_CACHE_VAL(ac_cv_const_$1, [AC_EGREP_CPP($1, [#include "confsrc/pconfig.h"], eval "ac_cv_const_$1=yes", AC_EGREP_CPP(yes, [#include "confsrc/pconfig.h" #ifdef $1 yes #endif], eval "ac_cv_const_$1=yes", eval "ac_cv_const_$1=no"))])dnl if eval "test \"`echo '$ac_cv_const_'$1`\" = yes"; then AC_DEFINE_UNQUOTED(HAVE_$1) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi ]) dnl AC_POSIX_CONSTS(CONST-NAME...) AC_DEFUN(AC_POSIX_CONSTS, [for ac_const in $1 do AC_POSIX_CONST($ac_const) done ]) dnl AC_POSIX_STRUCT(NAME, dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) AC_DEFUN(AC_POSIX_STRUCT, [AC_REQUIRE([AC_POSIX_HEADERS])dnl AC_MSG_CHECKING(for struct $1) AC_CACHE_VAL(ac_cv_struct_$1, [AC_TRY_COMPILE([#include "confsrc/pconfig.h" struct $1 x;],,eval "ac_cv_struct_$1=yes", eval "ac_cv_struct_$1=no")])dnl if eval "test \"`echo '$ac_cv_struct_'$1`\" = yes"; then AC_DEFINE_UNQUOTED(HAVE_struct_$1) AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) ifelse([$3], , , [$3])dnl fi ]) dnl AC_POSIX_STRUCTS(NAME...) AC_DEFUN(AC_POSIX_STRUCTS, [for ac_struct in $1 do AC_POSIX_STRUCT($ac_struct) done ]) dnl AC_POSIX_FUNCS(FUNCTION... ) AC_DEFUN(AC_POSIX_FUNCS, [for ac_func in $1 do AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(HAVE_$ac_func,1)], [AC_DEFINE_UNQUOTED(HAVE_$ac_func,0)])dnl done ]) dnl AC_POSIX_VAR(NAME) AC_DEFUN(AC_POSIX_VAR, [AC_REQUIRE([AC_POSIX_HEADERS])dnl AC_MSG_CHECKING(for global variable or macro $1) AC_CACHE_VAL(ac_cv_comp_$1, [AC_EGREP_CPP($1, [#include "confsrc/pconfig.h"], eval "ac_cv_comp_$1=yes", eval "ac_cv_comp_$1=no")])dnl if eval "test \"`echo '$ac_cv_comp_'$1`\" = yes"; then AC_DEFINE_UNQUOTED(HAVE_$1) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi ]) dnl AC_POSIX_COMP(STRUCTNAME, COMPNAME) AC_DEFUN(AC_POSIX_COMP, [AC_REQUIRE([AC_POSIX_HEADERS])dnl AC_MSG_CHECKING(for struct $1 component $2) AC_CACHE_VAL(ac_cv_comp_$2, [AC_TRY_COMPILE([#include "confsrc/pconfig.h" struct $1 x;], [x.$2 = x.$2;], eval "ac_cv_comp_$2=yes", eval "ac_cv_comp_$2=no")])dnl if eval "test \"`echo '$ac_cv_comp_'$2`\" = yes"; then AC_DEFINE_UNQUOTED(HAVE_component_$2) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi ]) dnl AC_POSIX_COMP_OVERLAY(STRUCTNAME, COMPNAME1, COMPNAME2) dnl check for COMPNAME1 but only if it does not overlay in memory dnl layout with COMPNAME2; e.g. see overlaying of sigaction components dnl sa_handler and sa_sigaction AC_DEFUN(AC_POSIX_COMP_OVERLAY, [AC_REQUIRE([AC_POSIX_HEADERS])dnl AC_MSG_CHECKING(for struct $1 component $2 overlaying $3) AC_CACHE_VAL(ac_cv_comp_$2, AC_TRY_RUN([#include "confsrc/pconfig.h" main() { struct $1 x; if (&x.$2 == &x.$3) { fprintf(stderr,"$2 overlays $3..."); exit (1); } else { exit (0); } }], eval "ac_cv_comp_$2=yes", eval "ac_cv_comp_$2=no", eval "ac_cv_comp_$2=nu"))dnl if eval "test \"`echo '$ac_cv_comp_'$2`\" = yes"; then AC_DEFINE_UNQUOTED(HAVE_component_$2) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi ]) florist-gpl-2017-src/Makefile.in0000644000076700001450000001175413106553472016072 0ustar gnatmailgnat# This builds the "Florist" implementation of POSIX.5b # # If you need to modify the "configure" file, you will need # autoconf version 2.12, or maybe a later version will also work. # .POSIX: VERSION=Florist-2017 (20170515) FLORIST_VERSION=$(VERSION) GNATPREPFLAGS = -c -r GCCFLAGS = -O2 TARGET=@host_alias@ ifneq ($(TARGET),) TARGET_OPTION=--target=$(TARGET) TARGET_PREFIX=$(TARGET)- endif ifeq ($(TARGET),powerpc-elinos-linux) TARGET_RUNNER=run-cross --target=ppc-elinos,5.1,qemu endif # How to invoke ranlib. RANLIB = ranlib # configure substitutions CC = @CC@ LIBS = @LIBS@ DEPS = @DEPS@ SIGNALS_GENERATED = @SIGNALS_GENERATED@ PREFIX = @prefix@ PROJECT_FLAGS = @LIBRARY_TYPE_OPTION@ @BUILD_TYPE_OPTION@ @THREADS_OPTION@ @RTS_OPTION@ $(TARGET_OPTION) # Scenario variables and RTS selection must be passed consistently to # project-aware tools gprbuild, gprinstall, and gprclean. GNATPREP = $(TARGET_PREFIX)gnatprep GPRBUILD = gprbuild GPRBUILD_FLAGS = $(GCCFLAGS) $(LIBRARY_TYPE_OPTION) $(PROJECT_FLAGS) GENDIR = gensrc GENDIR_ON_TARGET=$(GENDIR) # files generated by "configure" script CONFIG_GENERATED = \ confsrc/config.h\ confsrc/pconfig.h\ gnatprep.config\ pconfig.h.in CONFIG_HISTORY = \ config.cache\ config.log\ c-posix.log\ configure.log\ config.status\ stamp-h # files generated by "c-posix" program C-POSIX_GENERATED = \ $(GENDIR)/posix.ads\ $(GENDIR)/posix-limits.ads\ $(GENDIR)/posix-options.ads\ $(GENDIR)/posix-c.ads # files generated by "c-posix-signals" program (if present) ifneq "$(strip $(SIGNALS_GENERATED))" "" C-POSIX-SIGNALS_GENERATED = $(GENDIR)/$(SIGNALS_GENERATED) else C-POSIX-SIGNALS_GENERATED = endif GNATPREP_SOURCES = $(GENDIR)/posix-implementation.adb $(GENDIR)/threads/posix-timers-extensions.adb GENERATED = $(C-POSIX_GENERATED) $(C-POSIX-SIGNALS_GENERATED) $(GNATPREP_SOURCES) # all the executable programs EXECUTABLES = c-posix c-posix-signals # default target, get the gnat version and the system type and then # set up files and call make again (in uname) all: floristlib # # ------------------------------------ # configure-script # ------------------------------------ # # This first step should not need to be done during # normal installation # configure: configure.in aclocal.m4 autoconf # # ------------------------------------ # generation of OS dependent sources # ------------------------------------ # # Program c-posix generates some Ada package specs. # It is supposed to be a "portable" POSIX C program. # If it does not compile or does not link, # it might be fixable by hand-editing config.h or pconfig.h. # If you are unlucky, it will require fixes to c-posix.c. # c-posix: c-posix.c confsrc/config.h confsrc/pconfig.h $(CC) $(GCCFLAGS) -DVERSION="\"$(VERSION)\"" -DLIBS="\"$(LIBS)\"" -DGENDIR="\"$(GENDIR_ON_TARGET)\"" -o c-posix c-posix.c $(LIBS) # # Program c-posix-signals generates another Ada package spec. # c-posix-signals: c-posix-signals.c $(CC) $(GCCFLAGS) -DGENDIR="\"$(GENDIR_ON_TARGET)\"" -o c-posix-signals c-posix-signals.c $(LIBS) # # generate Ada source files using "c-posix" program # $(C-POSIX_GENERATED): c-posix mkdir -p $(GENDIR) && cd $(GENDIR) && rm -f posix.ads posix-limits.ads posix-options.ads posix-c.ads # See file "c-posix.log" for results of this step. $(TARGET_RUNNER) ./c-posix > c-posix.log 2>&1 # # generate Ada source files using "c-posix-signals" program # $(C-POSIX-SIGNALS_GENERATED): c-posix-signals mkdir -p $(GENDIR) && cd $(GENDIR) && rm -f posix-implementations-ok_signals.ads # See file "c-posix-signals.log" for results of this step. $(TARGET_RUNNER) ./c-posix-signals -nodefaults > c-posix-signals.log 2>&1 # # Some other Ada source files are tailored to the # particular OS using the "gnatprep" program. # The sources for these end in ".gpb" and ".gps". # .SUFFIXES: .gps .gpb .ads .adb .o .c $(GENDIR)/%.ads: libsrc/%.gps gnatprep.config mkdir -p `dirname $@` && $(GNATPREP) $< $@ gnatprep.config $(GNATPREPFLAGS) $(GENDIR)/%.adb: libsrc/%.gpb gnatprep.config mkdir -p `dirname $@` && $(GNATPREP) $< $@ gnatprep.config $(GNATPREPFLAGS) .c.o: $(CC) -c $(GCCFLAGS) $< # # ------------------------------------ # compilation of Florist packages # ------------------------------------ # force: floristlib: $(GENERATED) force $(GPRBUILD) -p $(GPRBUILD_FLAGS) -Pflorist # # ----------------------------------- # Maintenance targets # ----------------------------------- # # remove all c-posix and gnatprep generated files regen: rm -f $(GENERATED) # remove editor and compiler generated files clean: regen gprclean -Pflorist $(PROJECT_FLAGS) rm -rf obj lib rm -f *# *~ $(EXECUTABLES) b__* b~* # remove all generated files, including configuration history distclean: clean rm -f $(CONFIG_HISTORY) $(CONF_GENERATED) # install floristlib # make all files read-only to prevent recompilation install: gprinstall -Pflorist $(PROJECT_FLAGS) -a -p -f --prefix=$(PREFIX) --sources-subdir=floristlib --lib-subdir=floristlib --link-lib-subdir=floristlib chmod a-w $(PREFIX)/floristlib/* .PHONY: all install clean distclean regen floristlib force florist-gpl-2017-src/COPYING30000644000076700001450000010451312773206226015140 0ustar gnatmailgnat GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . florist-gpl-2017-src/CHANGES0000644000076700001450000000017713106553473015016 0ustar gnatmailgnat{anod.anod: 9a171cd8193e589b0a9d821cfe129739305ac49d, florist: 255717, florist.anod: 4339d1a65400b775cb16336758051c71e048de2d}