home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / adav313.zip / gnat-3_13p-os2-bin-20010916.zip / emx / gnatlib / s-osinte.ads < prev    next >
Text File  |  2000-07-19  |  7KB  |  164 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                 GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS              --
  4. --                                                                          --
  5. --                   S Y S T E M . O S _ I N T E R F A C E                  --
  6. --                                                                          --
  7. --                                  S p e c                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.7 $                             --
  10. --                                                                          --
  11. --            Copyright (C) 1991-1998 Florida State University              --
  12. --                                                                          --
  13. -- GNARL is free software; you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNARL; see file COPYING.  If not, write --
  21. -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
  22. -- MA 02111-1307, USA.                                                      --
  23. --                                                                          --
  24. -- As a special exception,  if other files  instantiate  generics from this --
  25. -- unit, or you link  this unit with other files  to produce an executable, --
  26. -- this  unit  does not  by itself cause  the resulting  executable  to  be --
  27. -- covered  by the  GNU  General  Public  License.  This exception does not --
  28. -- however invalidate  any other reasons why  the executable file  might be --
  29. -- covered by the  GNU Public License.                                      --
  30. --                                                                          --
  31. -- GNARL was developed by the GNARL team at Florida State University. It is --
  32. -- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
  33. -- State University (http://www.gnat.com).                                  --
  34. --                                                                          --
  35. ------------------------------------------------------------------------------
  36.  
  37. --  This is the OS/2 version of this package
  38.  
  39. --  This package encapsulates all direct interfaces to OS services
  40. --  that are needed by children of System.
  41.  
  42. --  PLEASE DO NOT add any with-clauses to this package
  43. --  or remove the pragma Preelaborate.
  44.  
  45. --  It is designed to be a bottom-level (leaf) package.
  46.  
  47. with Interfaces.C;
  48. package System.OS_Interface is
  49.    pragma Preelaborate;
  50.  
  51.    package C renames Interfaces.C;
  52.  
  53.    subtype int            is C.int;
  54.    subtype unsigned_long  is C.unsigned_long;
  55.  
  56.    type Duration_In_Millisec is new C.long;
  57.    --  New type to prevent confusing time functions in this package
  58.    --  with time functions returning seconds or other units.
  59.  
  60.    type Thread_Id is new unsigned_long;
  61.  
  62.    -----------
  63.    -- Errno --
  64.    -----------
  65.  
  66.    function errno return int;
  67.    pragma Import (C, errno, "__get_errno");
  68.  
  69.    --  NAMEs not used are commented-out
  70.    --  NAMEs not supported on this system have __NAME for value
  71.  
  72.    --  E2BIG    : constant := 3;
  73.    --  EACCES   : constant := 4;
  74.    EAGAIN   : constant := 5;
  75.    --  EBADF    : constant := 6;
  76.    --  EBUSY    : constant := 7;
  77.    --  ECHILD   : constant := 8;
  78.    --  EDEADLK  : constant := 9;
  79.    --  EDOM     : constant := 1;
  80.    --  EEXIST   : constant := 10;
  81.    --  EFAULT   : constant := 11;
  82.    --  EFBIG    : constant := 12;
  83.    EINTR    : constant := 13;
  84.    EINVAL   : constant := 14;
  85.    --  EIO      : constant := 15;
  86.    --  EISDIR   : constant := 16;
  87.    --  EMFILE   : constant := 17;
  88.    --  EMLINK   : constant := 18;
  89.    --  ENAMETOOLONG : constant := 19;
  90.    --  ENFILE   : constant := 20;
  91.    --  ENODEV   : constant := 21;
  92.    --  ENOENT   : constant := 22;
  93.    --  ENOEXEC  : constant := 23;
  94.    --  ENOLCK   : constant := 24;
  95.    ENOMEM   : constant := 25;
  96.    --  ENOSPC   : constant := 26;
  97.    --  ENOSYS   : constant := 27;
  98.    --  ENOTDIR  : constant := 28;
  99.    --  ENOTEMPTY    : constant := 29;
  100.    --  ENOTTY   : constant := 30;
  101.    --  ENXIO    : constant := 31;
  102.    --  EPERM    : constant := 32;
  103.    --  EPIPE    : constant := 33;
  104.    --  ERANGE   : constant := 2;
  105.    --  EROFS    : constant := 34;
  106.    --  ESPIPE   : constant := 35;
  107.    --  ESRCH    : constant := 36;
  108.    --   __ETIMEDOUT    : constant := 0;
  109.    --  EXDEV    : constant := 37;
  110.  
  111.    -------------
  112.    -- Signals --
  113.    -------------
  114.  
  115.    --  Signals for OS/2, only SIGTERM used currently. The values are
  116.    --  fake, since OS/2 uses 32 bit exception numbers that cannot be
  117.    --  used to index arrays etc. The GNULLI maps these Unix-like signals
  118.    --  to OS/2 exception numbers.
  119.  
  120.    --  SIGTERM is used for the abort interrupt.
  121.  
  122.    SIGHUP     : constant := 1;  --  hangup
  123.    SIGINT     : constant := 2;  --  interrupt (rubout)
  124.    SIGQUIT    : constant := 3;  --  quit (ASCD FS)
  125.    SIGILL     : constant := 4;  --  illegal instruction (not reset)
  126.    SIGTRAP    : constant := 5;  --  trace trap (not reset)
  127.    SIGIOT     : constant := 6;  --  IOT instruction
  128.    SIGEMT     : constant := 0;  --  EMT instruction
  129.    SIGFPE     : constant := 8;  --  floating point exception
  130.    SIGKILL    : constant := 9;  --  kill (cannot be caught or ignored)
  131.    SIGBUS     : constant := 10; --  bus error
  132.    SIGSEGV    : constant := 11; --  segmentation violation
  133.    SIGSYS     : constant := 12; --  bad argument to system call
  134.    SIGPIPE    : constant := 13; --  write on a pipe with no one to read it
  135.    SIGALRM    : constant := 14; --  alarm clock
  136.    SIGTERM    : constant := 15; --  software termination signal from kill
  137.  
  138.    subtype Signal is int range 0 .. SIGTERM;
  139.    subtype sigset_t is unsigned_long;
  140.  
  141.    ----------
  142.    -- Time --
  143.    ----------
  144.  
  145.    function Clock return Duration;
  146.    pragma Inline (Clock);
  147.    --  Clock measuring time since the epoch, which is the boot-time.
  148.    --  The clock resolution is approximately 838 ns.
  149.  
  150.    procedure Delay_For (Period : in Duration_In_Millisec);
  151.    pragma Inline (Delay_For);
  152.    --  Changed Sleep to Delay_For, for consistency with System.Time_Operations
  153.  
  154.    ----------------
  155.    -- Scheduling --
  156.    ----------------
  157.  
  158.    --  Put the calling task at the end of the ready queue for its priority
  159.  
  160.    procedure Yield;
  161.    pragma Inline (Yield);
  162.  
  163. end System.OS_Interface;
  164.