DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦642f115dd⟧ Ada Source

    Length: 52224 (0xcc00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, seg_013d81

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



--    The use of this system is subject to the software license terms and
--    conditions agreed upon between Rational and the Customer.
--
--                Copyright 1990 by Rational.
--
--                          RESTRICTED RIGHTS LEGEND
--
--    Use, duplication, or disclosure by the Government is subject to
--    restrictions as set forth in subdivision (b)(3)(ii) of the Rights in
--    Technical Data and Computer Software clause at 52.227-7013.
--
--
--                Rational
--                3320 Scott Boulevard
--                Santa Clara, California 95054-3197
--
--   PROPRIETARY AND CONFIDENTIAL INFORMATION OF RATIONAL;
--   USE OR COPYING WITHOUT EXPRESS WRITTEN AUTHORIZATION
--   IS STRICTLY PROHIBITED.  THIS MATERIAL IS PROTECTED AS
--   AN UNPUBLISHED WORK UNDER THE U.S. COPYRIGHT ACT OF
--   1976.  CREATED 1990.  ALL RIGHTS RESERVED.
--

WITH Unix_Base_Types;

PACKAGE System_Interface IS

   --
   -- This package provides a C-like interface to Unix system calls.
   -- This interface is a subset of Section 2 of the HP-UX Reference Manual.
   -- See the manual for a full description of these calls.
   --
   -- All data types are similar to the C definitions.  All subprograms are
   -- implemented via the appropriate interface pragmas.
   --
   -- The package is organized as follows:
   --
   --       Error       - error number constants
   --       File_Access - file access operations
   --       File_Io     - primitive input/output operations
   --       Ids         - identifier and group operations
   --       Process     - process operations
   --       Shell       - shell (command line) operations
   --       Sockets     - socket operations
   --       Time        - timer operations
   --

   PACKAGE Error IS

      -- Errno : Unix_Base_Types.Int;
      -- PRAGMA Linkname (Errno, "errno");
      -- the pragma linknames takes subprograms only, so we build a
      -- errno function

      FUNCTION Errno RETURN Unix_Base_Types.Int;
      PRAGMA Interface (C, Errno);
      PRAGMA Linkname (Errno, "F_Errno");

      -- error indicator for system calls  ERRNO(2)


      -- Error codes.  See /usr/include/sys/errno.h.

      Eperm   : CONSTANT := 1; -- Not super-user
      Enoent  : CONSTANT := 2; -- No such file or directory
      Esrch   : CONSTANT := 3; -- No such process
      Eintr   : CONSTANT := 4; -- interrupted system call
      Eio     : CONSTANT := 5; -- I/O error
      Enxio   : CONSTANT := 6; -- No such device or address
      E2big   : CONSTANT := 7; -- Arg list too long
      Enoexec : CONSTANT := 8; -- Exec format error
      Ebadf   : CONSTANT := 9; -- Bad file number
      Echild  : CONSTANT := 10; -- No children
      Eagain  : CONSTANT := 11; -- No more processes
      Enomem  : CONSTANT := 12; -- Not enough core
      Eacces  : CONSTANT := 13; -- Permission denied
      Efault  : CONSTANT := 14; -- Bad address
      Enotblk : CONSTANT := 15; -- Block device required
      Ebusy   : CONSTANT := 16; -- Mount device busy
      Eexist  : CONSTANT := 17; -- File exists
      Exdev   : CONSTANT := 18; -- Cross-device link
      Enodev  : CONSTANT := 19; -- No such device
      Enotdir : CONSTANT := 20; -- Not a directory
      Eisdir  : CONSTANT := 21; -- Is a directory
      Einval  : CONSTANT := 22; -- Invalid argument
      Enfile  : CONSTANT := 23; -- File table overflow
      Emfile  : CONSTANT := 24; -- Too many open files
      Enotty  : CONSTANT := 25; -- Not a typewriter
      Etxtbsy : CONSTANT := 26; -- Text file busy
      Efbig   : CONSTANT := 27; -- File too large
      Enospc  : CONSTANT := 28; -- No space left on device
      Espipe  : CONSTANT := 29; -- Illegal seek
      Erofs   : CONSTANT := 30; -- Read only file system
      Emlink  : CONSTANT := 31; -- Too many links
      Epipe   : CONSTANT := 32; -- Broken pipe
      Edom    : CONSTANT := 33; -- Math arg out of domain of func
      Erange  : CONSTANT := 34; -- Math result not representable
      Enomsg  : CONSTANT := 35; -- No message of desired type
      Eidrm   : CONSTANT := 36; -- Identifier removed

      -- The error numbers between 37 and 44 are not produced by HP-UX. They
      -- will track whatever the UNIX(tm) system does in the future
      Echrng   : CONSTANT := 37; -- Channel number out of range
      El2nsync : CONSTANT := 38; -- Level 2 not synchronized
      El3hlt   : CONSTANT := 39; -- Level 3 halted
      El3rst   : CONSTANT := 40; -- Level 3 reset
      Elnrng   : CONSTANT := 41; -- Link number out of range
      Eunatch  : CONSTANT := 42; -- Protocol driver not attached
      Enocsi   : CONSTANT := 43; -- No CSI structure available
      El2hlt   : CONSTANT := 44; -- Level 2 halted
      Edeadlk  : CONSTANT := 45; -- A deadlock would occur
      Enolck   : CONSTANT := 46; -- System record lock table was full

      -- Network File System
      Estale  : CONSTANT := 70; -- Stale NFS file handle
      Eremote : CONSTANT := 71; -- Too many levels of remote in path

      -- ipc/network software

      -- argument errors
      Enotsock        : CONSTANT := 216; -- Socket operation on non-socket
      Edestaddrreq    : CONSTANT := 217; -- Destination address required
      Emsgsize        : CONSTANT := 218; -- Message too long
      Eprototype      : CONSTANT := 219; -- Protocol wrong type for socket
      Enoprotoopt     : CONSTANT := 220; -- Protocol not available
      Eprotonosupport : CONSTANT := 221; -- Protocol not supported
      Esocktnosupport : CONSTANT := 222; -- Socket type not supported
      Eopnotsupp      : CONSTANT := 223; -- Operation not supported
      Epfnosupport    : CONSTANT := 224; -- Protocol family not supported
      Eafnosupport    : CONSTANT := 225; -- Address family not supported by
                                         -- protocol family
      Eaddrinuse      : CONSTANT := 48; -- Address already in use
      Eaddrnotavail   : CONSTANT := 227; -- Can't assign requested address

      -- operational errors
      Enetdown       : CONSTANT := 228; -- Network is down
      Enetunreach    : CONSTANT := 229; -- Network is unreachable
      Enetreset      : CONSTANT := 230; -- Network dropped connection on
                                        -- reset
      Econnaborted   : CONSTANT := 231; -- Software caused connection abort
      Econnreset     : CONSTANT := 232; -- Connection reset by peer
      Enobufs        : CONSTANT := 233; -- No buffer space available
      Eisconn        : CONSTANT := 234; -- Socket is already connected
      Enotconn       : CONSTANT := 235; -- Socket is not connected
      Eshutdown      : CONSTANT := 236; -- Can't send after socket shutdown
      Etoomanyrefs   : CONSTANT := 237; -- Too many references: can't splice
      Etimedout      : CONSTANT := 238; -- Connection timed out
      Econnrefused   : CONSTANT := 239; -- Connection refused
      Eremoterelease : CONSTANT := 240; -- Remote peer released connection
      Ehostdown      : CONSTANT := 241; -- Host is down
      Ehostunreach   : CONSTANT := 242; -- No route to host
      Enet           : CONSTANT := 243; -- Network error
      Ealready       : CONSTANT := 244; -- Operation already in progress
      Einprogress    : CONSTANT := 245; -- Operation now in progress
      Ewouldblock    : CONSTANT := 246; -- Operation would block
      Enotempty      : CONSTANT := 247; -- Directory not empty
      Enametoolong   : CONSTANT := 248; -- File name too long
      Eloop          : CONSTANT := 249; -- Too many levels of symbolic links
      Enosys         : CONSTANT := 251; -- Function not implemented

   END Error;



   PACKAGE File_Access IS

      Seek_Set : CONSTANT := 0; -- Set file pointer to "offset"
      Seek_Cur : CONSTANT := 1; -- Set file pointer to current plus "offset"
      Seek_End : CONSTANT := 2; -- Set file pointer to EOF plus "offset"

      Read_Bit    : CONSTANT := 2#100#;
      Write_Bit   : CONSTANT := 2#010#;
      Execute_Bit : CONSTANT := 2#001#;

      Read_Mode       : CONSTANT := 2#100#;
      Read_Write_Mode : CONSTANT := 2#110#;

      Owner_Multiplier : CONSTANT := 2 ** 6;
      Group_Multiplier : CONSTANT := 2 ** 3;
      Other_Multiplier : CONSTANT := 2 ** 0;

      R_Ok : CONSTANT := 4; -- Test for "Read" Permission
      W_Ok : CONSTANT := 2; -- Test for "Write" Permission
      X_Ok : CONSTANT := 1; -- Test for "Execute" (Search) Permission
      F_Ok : CONSTANT := 0; -- Test for existence of file

      S_Ifmt  : CONSTANT := 8#0170000#;   -- type of file
      S_Ifnwk : CONSTANT := 8#0110000#;   -- network special
      S_Ififo : CONSTANT := 8#0010000#;   -- fifo
      S_Ifreg : CONSTANT := 8#0100000#;   -- regular
      S_Ifblk : CONSTANT := 8#0060000#;   -- block special
      S_Ifchr : CONSTANT := 8#0020000#;   -- character special
      S_Ifdir : CONSTANT := 8#0040000#;   -- directory
      S_Isuid : CONSTANT := 8#0004000#;   -- set user id on execution
      S_Isgid : CONSTANT := 8#0002000#;   -- set group id on execution
      S_Enfmt : CONSTANT := 8#0002000#;   -- enforced file locking
      S_Isvtx : CONSTANT := 8#0001000#;   -- save swapped text even after use
      S_Irwxu : CONSTANT := 8#0000700#;   -- rd/wrt/execute permission (owner)
      S_Irusr : CONSTANT := 8#000400#;   -- read permission (owner)
      S_Iwusr : CONSTANT := 8#0000200#;   -- write permission (owner)
      S_Ixusr : CONSTANT := 8#0000100#;   -- execute permission (owner)
      S_Irwxg : CONSTANT := 8#0000070#;   -- rd/wrt/execute permission (group)
      S_Irgrp : CONSTANT := 8#0000040#;   -- read permission (group)
      S_Iwgrp : CONSTANT := 8#0000020#;   -- write permission (group)
      S_Ixgrp : CONSTANT := 8#0000010#;   -- execute permission (group)
      S_Irwxo : CONSTANT := 8#0000007#;   -- rd/wrt/execute permission (other)
      S_Iroth : CONSTANT := 8#0000004#;   -- read permission (other)
      S_Iwoth : CONSTANT := 8#0000002#;   -- write permission (other)
      S_Ixoth : CONSTANT := 8#0000001#;   -- execute permission (other)

      SUBTYPE Ino_T   IS Unix_Base_Types.U_Long;
      SUBTYPE Dev_T   IS Unix_Base_Types.Long;
      SUBTYPE Off_T   IS Unix_Base_Types.Long;
      SUBTYPE Mode_T  IS Unix_Base_Types.U_Short;
      SUBTYPE Nlink_T IS Unix_Base_Types.Short;
      SUBTYPE Time_T  IS Unix_Base_Types.Long;
      SUBTYPE Cnode_T IS Unix_Base_Types.U_Short;
      SUBTYPE Site_T  IS Unix_Base_Types.U_Short;

      SUBTYPE Pid_T   IS Unix_Base_Types.Long;
      SUBTYPE Pad_Int IS Unix_Base_Types.Uint
                            RANGE -(2 ** 29) .. (2 ** 29) - 1;

      Spare4_Size : CONSTANT := 3;
      TYPE Spare4_Array IS ARRAY (1 .. Spare4_Size) OF Unix_Base_Types.Long;

      TYPE Stt IS
         RECORD
            St_Dev        : Dev_T;  
            St_Ino        : Ino_T;  
            St_Mode       : Mode_T;  
            St_Nlink      : Nlink_T;
            St_Reserved1  : Unix_Base_Types.U_Short; -- old st_uid
            St_Reserved2  : Unix_Base_Types.U_Short; -- old st_gid
            St_Rdev       : Dev_T;  
            St_Size       : Off_T;  
            St_Atime      : Time_T;  
            St_Spare1     : Unix_Base_Types.Int;  
            St_Mtime      : Time_T;  
            St_Spare2     : Unix_Base_Types.Int;  
            St_Ctime      : Time_T;  
            St_Spare3     : Unix_Base_Types.Int;  
            St_Blksize    : Unix_Base_Types.Long;  
            St_Blocks     : Unix_Base_Types.Long;
            St_Pad        : Pad_Int;
            St_Acl        : Boolean;               -- Set if there are optional
                                                   -- ACL entries
            St_Remote     : Boolean;               -- Set if file is remote
            St_Netdev     : Dev_T;                 -- ID of device containing
                                                   -- network special file
            St_Netino     : Ino_T;                 -- Inode number of network
                                                   -- special file
            St_Cnode      : Cnode_T;
            St_Rcnode     : Cnode_T;
            St_Netsite    : Site_T;                -- The site where the
                                                   -- network device lives
            St_Fstype     : Unix_Base_Types.Short;  
            St_Realdev    : Dev_T;                 -- Real device number of
                                                   -- device containing the
                                                   -- inode for this file
            St_Basemode   : Unix_Base_Types.Ushort;
            St_Spareshort : Unix_Base_Types.Ushort;
            St_Uid        : Unix_Base_Types.Short; -- Uid_T;
            St_Gid        : Unix_Base_Types.Short; -- Gid_T;
            St_Spare4     : Spare4_Array;
         END RECORD;

      FOR Stt USE
         RECORD
            St_Dev        AT 0  RANGE 0 .. 31;
            St_Ino        AT 4  RANGE 0 .. 31;
            St_Mode       AT 8  RANGE 0 .. 15;
            St_Nlink      AT 10 RANGE 0 .. 15;
            St_Reserved1  AT 12 RANGE 0 .. 15;
            St_Reserved2  AT 14 RANGE 0 .. 15;
            St_Rdev       AT 16 RANGE 0 .. 31;
            St_Size       AT 20 RANGE 0 .. 31;
            St_Atime      AT 24 RANGE 0 .. 31;
            St_Spare1     AT 28 RANGE 0 .. 31;
            St_Mtime      AT 32 RANGE 0 .. 31;
            St_Spare2     AT 36 RANGE 0 .. 31;
            St_Ctime      AT 40 RANGE 0 .. 31;
            St_Spare3     AT 44 RANGE 0 .. 31;
            St_Blksize    AT 48 RANGE 0 .. 31;
            St_Blocks     AT 52 RANGE 0 .. 31;
            St_Pad        AT 56 RANGE 0 .. 29;  
            St_Acl        AT 56 RANGE 30 .. 30;  
            St_Remote     AT 56 RANGE 31 .. 31;  
            St_Netdev     AT 60 RANGE 0 .. 31;  
            St_Netino     AT 64 RANGE 0 .. 31;
            St_Cnode      AT 68 RANGE 0 .. 15;
            St_Rcnode     AT 70 RANGE 0 .. 15;
            St_Netsite    AT 72 RANGE 0 .. 15;
            St_Fstype     AT 74 RANGE 0 .. 15;
            St_Realdev    AT 76 RANGE 0 .. 31;  
            St_Basemode   AT 80 RANGE 0 .. 15;
            St_Spareshort AT 82 RANGE 0 .. 15;
            St_Uid        AT 84 RANGE 0 .. 15;
            St_Gid        AT 86 RANGE 0 .. 15;
            St_Spare4     AT 88 RANGE 0 .. 95;
         END RECORD;


      TYPE Stat_Ptr IS ACCESS Stt;
      -- Storage will be allocated in user's program, hence no address clause
      -- of zero.


      TYPE Flock IS
         RECORD
            L_Type   : Unix_Base_Types.Short; -- F_RDLCK, F_WRLCK, or F_UNLCK
            L_Whence : Unix_Base_Types.Short; -- starting offset (like lseek)
            L_Start  : Off_T;                 -- relative offset
            L_Len    : Off_T;                 -- len=0 means until end of file
            L_Pid    : Pid_T;  
         END RECORD;


      TYPE Flock_Fields IS (Int_Field, Struct_Field);


      TYPE Flock_Union (Field : Flock_Fields) IS
         RECORD
            CASE Field IS
               WHEN Int_Field =>
                  Val : Unix_Base_Types.Int;
               WHEN Struct_Field =>
                  Lockdes : Flock;
            END CASE;
         END RECORD;


      TYPE Flock_Ptr       IS ACCESS Flock;
      TYPE Flock_Union_Ptr IS ACCESS Flock_Union;
      -- Type definitions for fcntl argument


      -- Operations...

      -- The man page for Chmod agrees with this parameter profile, however,
      -- the SunAda compiler requires that discrete types passed to a C
      -- routine be 32-bits long.  Mode_T is only 16-bits long.  Therefore
      -- we will provide a body for Chmod which will utilize the Unix
      -- package supplied by SunAda/VADS in the "standard" library.
      --
      FUNCTION Chmod (Path : IN Unix_Base_Types.Char_Ptr;  
                      Mode : IN Mode_T)  
                     RETURN Unix_Base_Types.Int;
      -- change access mode of file  CHMOD(2)


      -- The SunOS man page for Fchmod indicates that the Mode parameter
      -- should be of type integer and not Mode_T.
      --
      FUNCTION Fchmod (Fildes : IN Unix_Base_Types.Int;  
                       Mode   : IN Unix_Base_Types.Int)  
                      RETURN Unix_Base_Types.Int;
      -- change access mode of file  CHMOD(2)
      PRAGMA Interface (C, Fchmod);
      PRAGMA Linkname (Fchmod, "fchmod");



      FUNCTION Stat (Path : IN Unix_Base_Types.Char_Ptr;  
                     Buf  : IN Stat_Ptr)  
                    RETURN Unix_Base_Types.Int;
      -- get file status  STAT(2)
      PRAGMA Interface (C, Stat);
      PRAGMA Linkname (Stat, "stat");



      FUNCTION Lstat (Path : IN Unix_Base_Types.Char_Ptr;  
                      Buf  : IN Stat_Ptr) RETURN Unix_Base_Types.Int;
      -- get file status  STAT(2)
      PRAGMA Interface (C, Lstat);
      PRAGMA Linkname (Lstat, "lstat");



      FUNCTION Fstat (Fildes : IN Unix_Base_Types.Int;  
                      Buf    : IN Stat_Ptr) RETURN Unix_Base_Types.Int;
      -- get file status  STAT(2)
      PRAGMA Interface (C, Fstat);
      PRAGMA Linkname (Fstat, "fstat");



      FUNCTION Accss (Path  : IN Unix_Base_Types.Char_Ptr;
                      Amode : IN Unix_Base_Types.Int)  
                     RETURN Unix_Base_Types.Int;
      -- determine accessibility of a file  ACCESS(2)
      PRAGMA Interface (C, Accss);
      PRAGMA Linkname (Accss, "access");



      FUNCTION Chown (Path  : IN Unix_Base_Types.Char_Ptr;
                      Owner : IN Unix_Base_Types.Int;
                      Group : IN Unix_Base_Types.Int)  
                     RETURN Unix_Base_Types.Int;
      -- change owner and group of a file  CHOWN(2)
      PRAGMA Interface (C, Chown);
      PRAGMA Linkname (Chown, "chown");



      FUNCTION Fchown (Fd    : IN Unix_Base_Types.Int;
                       Owner : IN Unix_Base_Types.Int;
                       Group : IN Unix_Base_Types.Int)  
                      RETURN Unix_Base_Types.Int;
      -- change owner and group of a file  CHOWN(2)
      PRAGMA Interface (C, Fchown);
      PRAGMA Linkname (Fchown, "fchown");



      FUNCTION Fcntl (Fildes : Unix_Base_Types.Int;
                      Cmd    : Unix_Base_Types.Int;
                      Arg    : Flock_Ptr) RETURN Unix_Base_Types.Int;
      -- File control
      PRAGMA Interface (C, Fcntl);
      PRAGMA Linkname (Fcntl, "fcntl");


      FUNCTION Lseek (Fildes : IN Unix_Base_Types.Int;
                      Offset : IN Unix_Base_Types.Long;
                      Whence : IN Unix_Base_Types.Int)
                     RETURN Unix_Base_Types.Long;
      -- move read/write file pointer; seek  LSEEK(2)
      PRAGMA Interface (C, Lseek);
      PRAGMA Linkname (Lseek, "lseek");



      -- The SunOS man page for Mknod indicates that the Mode parameter
      -- should be of type integer and not Mode_T.
      --
      FUNCTION Mknod (Path : IN Unix_Base_Types.Char_Ptr;
                      Mode : IN Unix_Base_Types.Int;
                      Dev  : IN Dev_T) RETURN Unix_Base_Types.Int;
      -- make a directory , or a special or regular file; see MKNOD(2)
      PRAGMA Interface (C, Mknod);
      PRAGMA Linkname (Mknod, "mknod");


      -- There is no SunOS man page for Mkrnod.  I don't know if the
      -- parameter profile is correct or if it even exists in the SunOS C
      -- library.
      --
      FUNCTION Mkrnod (Path    : IN Unix_Base_Types.Char_Ptr;
                       Mode    : IN Unix_Base_Types.Int;
                       Dev     : IN Unix_Base_Types.Long;
                       Cnodeid : IN Unix_Base_Types.Long)
                      RETURN Unix_Base_Types.Int;
      -- make a device file that can be access from a differenet cnode
      PRAGMA Interface (C, Mkrnod);
      PRAGMA Linkname (Mkrnod, "mkrnod");


      PROCEDURE Sync;
      PRAGMA Interface (C, Sync);
      PRAGMA Linkname (Sync, "sync");


      PROCEDURE Lsync;
      -- update super-block
      PRAGMA Interface (C, Lsync);
      PRAGMA Linkname (Lsync, "lsync");


      -- The man page indicates that the following would conform to System V
      -- Unix conventions but that the SunOS also supports the alternative
      -- form used here because of the SunAda requirement that discrete
      -- parameters to C routines be 32-bits long.
      -- FUNCTION Umask (Cmask : IN Mode_T) RETURN Mode_T;
      --
      FUNCTION Umask (Cmask : IN Unix_Base_Types.Int)  
                     RETURN Unix_Base_Types.Int;
      -- Set and get file creation mask
      PRAGMA Interface (C, Umask);
      PRAGMA Linkname (Umask, "unmask");

   END File_Access;

   PACKAGE File_Io IS

      --
      -- Flag values accessible to OPEN(2) and FCNTL(2)
      -- (The first three can only be set by open)
      --
      O_Rdonly   : CONSTANT := 0;
      O_Wronly   : CONSTANT := 1;
      O_Rdwr     : CONSTANT := 2;
      O_Accmode  : CONSTANT := 3;      -- mask for file access modes
      O_Ndelay   : CONSTANT := 4;      -- non-blocking i/o
      O_Append   : CONSTANT := 10;     -- append (writes guaranteed at the end)
      O_Nonblock : CONSTANT := 200000; -- POSIX non-blocking I/O

      --
      -- Flag values accessible only to OPEN(2)
      --
      O_Creat : CONSTANT := 00400; -- open with file create (uses third
                                   -- open arg)
      O_Trunc : CONSTANT := 01000; -- open with truncation
      O_Excl  : CONSTANT := 02000; -- exclusive open

      -- Constants greater than Integer'Last will be appropriately negated.

      Fionread     : CONSTANT := 16#4004667f#;  
      Fionbio      : CONSTANT := -16#7ffb9982#;  
      Fiosnbio     : CONSTANT := Fionbio;
      Fioasync     : CONSTANT := -16#7ffb9983#;  
      Fiossaiostat : CONSTANT := -16#7ffb9986#;
      Fiogsaiostat : CONSTANT := 16#40046679#;
      Fiossaioown  : CONSTANT := -16#7ffb9988#;
      Fiogsaioown  : CONSTANT := 16#40046677#;  
      Fiognbio     : CONSTANT := 16#40046675#;

      Iocparm_Mask : CONSTANT := 16#3fff#;
      Iocsize_Mask : CONSTANT := 16#3fff0000#; -- passed argument size in bytes

      Effective_Iocsize_Mask : CONSTANT := 16#7f0000#;     Effective_Iocparm_Mask : CONSTANT := 16#7f#;

      Ioccmd_Mask : CONSTANT := 16#0000ffff#;  -- command field
      Ioc_Void    : CONSTANT := -16#80000000#; -- no parameters, field size = 0
      Ioc_Out     : CONSTANT := 16#40000000#;  -- copy out parameters
      Ioc_In      : CONSTANT := -16#80000000#; -- copy in parameters

      Ioc_Inout : CONSTANT := 16#c0000000#;    -- not in range of Integer

      Stdin  : CONSTANT := 0;         -- standard input file descriptor
      Stdout : CONSTANT := 1;         -- standard output file descriptor
      Stderr : CONSTANT := 2;         -- standard error file descriptor

      SUBTYPE Mode_T IS System_Interface.File_Access.Mode_T;


      -- Operations...

      -- The man page for Creat indicates that the following profile is
      -- supported for System V compatibility, but the alternate form used
      -- here is also supported.  The alternate form is used to satisfy the
      -- SunAda compiler requirement that discrete parameters to C routines
      -- be 32-bits long.
      -- FUNCTION Creat (Path : IN Unix_Base_Types.Char_Ptr;
      --                 Mode : IN Mode_T)
      --                RETURN Unix_Base_Types.Int;
      --
      FUNCTION Creat (Path : IN Unix_Base_Types.Char_Ptr;  
                      Mode : IN Unix_Base_Types.Int)  
                     RETURN Unix_Base_Types.Int;
      -- create a new file or rewrite an existing one  CREAT(2)
      PRAGMA Interface (C, Creat);
      PRAGMA Linkname (Creat, "creat");



      FUNCTION Read (Fildes : IN Unix_Base_Types.Int;
                     Buf    : IN Unix_Base_Types.Char_Ptr;
                     Nbyte  : IN Unix_Base_Types.Unsigned)
                    RETURN Unix_Base_Types.Int;
      -- read input  READ(2)
      PRAGMA Interface (C, Read);
      PRAGMA Linkname (Read, "read");



      FUNCTION Write (Fildes : IN Unix_Base_Types.Int;
                      Buf    : IN Unix_Base_Types.Char_Ptr;
                      Nbyte  : IN Unix_Base_Types.Unsigned)
                     RETURN Unix_Base_Types.Int;
      -- write on a file  WRITE(2)
      PRAGMA Interface (C, Write);
      PRAGMA Linkname (Write, "write");



      FUNCTION Rename (Source : IN Unix_Base_Types.Char_Ptr;
                       Target : IN Unix_Base_Types.Char_Ptr)
                      RETURN Unix_Base_Types.Int;
      -- change the name of a file  RENAME(2)
      PRAGMA Interface (C, Rename);
      PRAGMA Linkname (Rename, "rename");



-- I will only provide one open function, see below
      -- FUNCTION Open (Path  : IN Unix_Base_Types.Char_Ptr;
      --                Oflag : IN Unix_Base_Types.Int)
      --               RETURN Unix_Base_Types.Int;
      -- open file for reading or writing  OPEN(2)
--      PRAGMA Interface (C, Open);
--      PRAGMA linkname (Open, "open");



      -- The man page for Open indicates that the following profile is
      -- supported for System V compatibility, but the alternate form used
      -- here is also supported.  The alternate form is used to satisfy the
      -- SunAda compiler requirement that discrete parameters to C routines
      -- be 32-bits long.
      --
      -- FUNCTION Open (Path  : IN Unix_Base_Types.Char_Ptr;
      --                Oflag : IN Unix_Base_Types.Int;
      --                Mode  : IN Mode_T)
      --               RETURN Unix_Base_Types.Int;
      --
      FUNCTION Open (Path  : IN Unix_Base_Types.Char_Ptr;
                     Oflag : IN Unix_Base_Types.Int;
                     Mode  : IN Unix_Base_Types.Int)  
                    RETURN Unix_Base_Types.Int;
      -- open file for reading or writing  OPEN(2)
      PRAGMA Interface (C, Open);
      PRAGMA Linkname (Open, "open");



      FUNCTION Close (Fildes : IN Unix_Base_Types.Int)
                     RETURN Unix_Base_Types.Int;
      -- close a file descriptor  CLOSE(2)
      PRAGMA Interface (C, Close);
      PRAGMA Linkname (Close, "close");



      FUNCTION Ioctl (Fildes  : IN Unix_Base_Types.Int;
                      Request : IN Unix_Base_Types.Int;
                      Arg     : IN Unix_Base_Types.Int)  
                     RETURN Unix_Base_Types.Int;
      -- control device  IOCTL(2)
      PRAGMA Interface (C, Ioctl);
      PRAGMA Linkname (Ioctl, "ioctl");

   END File_Io;



   PACKAGE Ids IS


      FUNCTION Getuid RETURN Unix_Base_Types.Unsigned_Short;
      -- get real user id  GETUID(2)
      PRAGMA Interface (C, Getuid);
      PRAGMA Linkname (Getuid, "getuid");



      FUNCTION Geteuid RETURN Unix_Base_Types.Unsigned_Short;
      -- get effective user id  GETUID(2)
      PRAGMA Interface (C, Geteuid);
      PRAGMA Linkname (Geteuid, "geteuid");



      FUNCTION Getgid RETURN Unix_Base_Types.Unsigned_Short;
      -- get real group id  GETUID(2)
      PRAGMA Interface (C, Getgid);
      PRAGMA Linkname (Getgid, "getgid");



      FUNCTION Getegid RETURN Unix_Base_Types.Unsigned_Short;
      -- get effective group id  GETUID(2)
      PRAGMA Interface (C, Getegid);
      PRAGMA Linkname (Getegid, "getegid");



      FUNCTION Getpid RETURN Unix_Base_Types.Int;
      -- get process id  GETPID(2)
      PRAGMA Interface (C, Getpid);  
      PRAGMA Linkname (Getpid, "getpid");



      FUNCTION Getpgrp RETURN Unix_Base_Types.Int;
      -- get process group id  GETPID(2)
      PRAGMA Interface (C, Getpgrp);
      PRAGMA Linkname (Getpgrp, "getpgrp");



      FUNCTION Getppid RETURN Unix_Base_Types.Int;
      -- get parent process id  GETPID(2)
      PRAGMA Interface (C, Getppid);  
      PRAGMA Linkname (Getppid, "getppid");



      FUNCTION Getpgrp2 (Pid : IN Unix_Base_Types.Int)  
                        RETURN Unix_Base_Types.Int;
      -- get process group id of the specified process  GETPID(2)
      PRAGMA Interface (C, Getpgrp2);     PRAGMA Linkname (Getpgrp2, "getpgrp2");



      FUNCTION Setuid (Uid : IN Unix_Base_Types.Int)  
                      RETURN Unix_Base_Types.Int;
      -- set user ID  SETUID(2)
      PRAGMA Interface (C, Setuid);
      PRAGMA Linkname (Setuid, "setuid");



      FUNCTION Setgid (Gid : IN Unix_Base_Types.Int)  
                      RETURN Unix_Base_Types.Int;
      -- set group ID  SETUID(2)
      PRAGMA Interface (C, Setgid);
      PRAGMA Linkname (Setgid, "setgid");


   END Ids;

   PACKAGE Process IS

      -- This type was added to correct the declaration of Execv.  The man
      -- page for Execv indicates that the Argv parameters is defined as
      -- char *q[].  That is, a pointer to an array of character pointers.
      --
      TYPE Char_Ptr_Array_Ptr IS ACCESS Unix_Base_Types.Char_Ptrs;

      -- Exit_Status : Unix_Base_Types.Int;
      -- -- The runtime system returns this value when exiting the
      -- -- Ada program.  The runtime system uses 0 by default.
      -- PRAGMA Linkname (Exit_Status, "__EXIT_STATUS");
      --
      -- Again as for errno we build a function
      --
      FUNCTION Exit_Status RETURN Unix_Base_Types.Int;
      PRAGMA Interface (C, Exit_Status);
      PRAGMA Linkname (Exit_Status, "F_Exit_Status");


      PROCEDURE Ext (Status : IN Unix_Base_Types.Int);
      -- exit or terminate process  EXIT(2)
      PRAGMA Interface (C, Ext);
      PRAGMA Linkname (Ext, "exit");


-- SunAda/Vads does not support the passing of access types to unconstrained
-- arrays to C routines.  Therefore, this routine will be implemented in the
-- body with a call to Unix_Prc.Execvp supplied by SunAda/VADS.
--
      FUNCTION Execv (Path : IN Unix_Base_Types.Char_Ptr;
                      Argv : IN Char_Ptr_Array_Ptr) RETURN Unix_Base_Types.Int;
      -- Execute a file
--      PRAGMA Interface (C, Execv);
--      PRAGMA linkname (Execv, "_execv");
--


      FNCTION Fork RETURN Unix_Base_Types.Int;
      -- create a new process  FORK(2)
      PRAGMA Interface (C, Fork);
      PRAGMA Linkname (Fork, "fork");



      FUNCTION Kill (Pid : IN Unix_Base_Types.Int;  
                     Sig : IN Unix_Base_Types.Int)  
                    RETURN Unix_Base_Types.Int;
      -- send a signal to a process or a group of processes  KILL(2)
      PRAGMA Interface (C, Kill);
      PRAGMA Linkname (Kill, "kill");


   END Process;


   PACKAGE Shell IS

      SUBTYPE Mode_T IS System_Interface.File_Access.Mode_T;

      -- The man page for Mkdir indicates that the following profile is
      -- supported for System V compatibility, but the alternate form used
      -- here is also supported.  The alternate form is used to satisfy the
      -- SunAda compiler requirement that discrete parameters to C routines
      -- be 32-bits long.
      -- FUNCTION Mkdir (Path : IN Unix_Base_Types.Char_Ptr;
      --                 Mode : IN Mode_T)
      --                RETURN Unix_Base_Types.Int;
      --
      FUNCTION Mkdir (Path : IN Unix_Base_Types.Char_Ptr;  
                      Mode : IN Unix_Base_Types.Int)  
                     RETURN Unix_Base_Types.Int;
      -- make a directory file  MKDIR(2)
      PRAGMA Interface (C, Mkdir);
      PRAGMA Linkname (Mkdir, "mkdir");



      FUNCTION Chdir (Path : IN Unix_Base_Types.Char_Ptr)
                     RETURN Unix_Base_Types.Int;
      -- change working directory  CHDIR(2)
      PRAGMA Interface (C, Chdir);
      PRAGMA Linkname (Chdir, "chdir");



      FUNCTION Chroot (Path : IN Unix_Base_Types.Char_Ptr)
                      RETURN Unix_Base_Types.Int;
      -- change root directory  CHROOT(2)
      PRAGMA Interface (C, Chroot);
      PRAGMA Linkname (Chroot, "chroot");



      FUNCTION Link (Path1 : IN Unix_Base_Types.Char_Ptr;
                     Path2 : IN Unix_Base_Types.Char_Ptr)
                    RETURN Unix_Base_Types.Int;
      -- link to a file  LINK(2)
      PRAGMA Interface (C, Link);
      PRAGMA Linkname (Link, "link");



      FUNCTION Rmdir (Path : IN Unix_Base_Types.Char_Ptr)
                     RETURN Unix_Base_Types.Int;
      -- remove a directory file  RMDIR(2)
      PRAGMA Interface (C, Rmdir);
      PRAGMA Linkname (Rmdir, "rmdir");



      FUNCTION Unlink (Path : IN Unix_Base_Types.Char_Ptr)
                      RETURN Unix_Base_Types.Int;
      -- remove directory entry; delete file  UNLINK(2)
      PRAGMA Interface (C, Unlink);
      PRAGMA Linkname (Unlink, "unlink");


   END Shell;




   PACKAGE Sockets IS

      Siocspgrp : CONSTANT := -16#7ffb8cf8#; -- set process group

   END Sockets;



   PACKAGE Time IS

      SUBTYPE Clock_T IS Unix_Base_Types.Unsigned_Long;

      TYPE Tms IS
         RECORD
            Tms_Utime  : Clock_T;    -- user time
            Tms_Stime  : Clock_T;    -- system time
            Tms_Cutime : Clock_T;    -- user time, children
            Tms_Cstime : Clock_T;    -- system time, children
         END RECORD;

      TYPE Tms_Ptr IS ACCESS Tms;
      --for Tms_Ptr'Storage_Size use 0;



      FUNCTION Time (Tloc : IN Unix_Base_Types.Long_Ptr)
                    RETURN Unix_Base_Types.Long;
      -- get time  TIME(2)
      PRAGMA Interface (C, Time);
      PRAGMA Linkname (Time, "time");



      FUNCTION Times (Buffer : Tms_Ptr) RETURN Clock_T;
      -- Get process and child times
      PRAGMA Interface (C, Times);
      PRAGMA Linkname (Times, "times");

   END Time;


END System_Interface;

E3 Meta Data

    nblk1=32
    nid=25
    hdr6=5e
        [0x00] rec0=1e rec1=00 rec2=01 rec3=03a
        [0x01] rec0=18 rec1=00 rec2=02 rec3=01e
        [0x02] rec0=18 rec1=00 rec2=03 rec3=05a
        [0x03] rec0=05 rec1=00 rec2=31 rec3=04a
        [0x04] rec0=13 rec1=00 rec2=04 rec3=054
        [0x05] rec0=00 rec1=00 rec2=30 rec3=02a
        [0x06] rec0=15 rec1=00 rec2=05 rec3=014
        [0x07] rec0=00 rec1=00 rec2=2f rec3=036
        [0x08] rec0=10 rec1=00 rec2=06 rec3=048
        [0x09] rec0=01 rec1=00 rec2=2e rec3=022
        [0x0a] rec0=0f rec1=00 rec2=07 rec3=008
        [0x0b] rec0=00 rec1=00 rec2=2d rec3=080
        [0x0c] rec0=1c rec1=00 rec2=08 rec3=02c
        [0x0d] rec0=00 rec1=00 rec2=2a rec3=046
        [0x0e] rec0=11 rec1=00 rec2=09 rec3=042
        [0x0f] rec0=00 rec1=00 rec2=29 rec3=002
        [0x10] rec0=10 rec1=00 rec2=0a rec3=044
        [0x11] rec0=19 rec1=00 rec2=28 rec3=022
        [0x12] rec0=01 rec1=00 rec2=0b rec3=042
        [0x13] rec0=10 rec1=00 rec2=27 rec3=060
        [0x14] rec0=01 rec1=00 rec2=2c rec3=080
        [0x15] rec0=16 rec1=00 rec2=0c rec3=022
        [0x16] rec0=02 rec1=00 rec2=0d rec3=01e
        [0x17] rec0=17 rec1=00 rec2=0e rec3=02e
        [0x18] rec0=03 rec1=00 rec2=2b rec3=000
        [0x19] rec0=20 rec1=00 rec2=0f rec3=074
        [0x1a] rec0=18 rec1=00 rec2=26 rec3=038
        [0x1b] rec0=1d rec1=00 rec2=10 rec3=036
        [0x1c] rec0=1d rec1=00 rec2=14 rec3=01a
        [0x1d] rec0=1a rec1=00 rec2=15 rec3=034
        [0x1e] rec0=1b rec1=00 rec2=12 rec3=008
        [0x1f] rec0=1a rec1=00 rec2=13 rec3=00e
        [0x20] rec0=17 rec1=00 rec2=16 rec3=002
        [0x21] rec0=00 rec1=00 rec2=24 rec3=030
        [0x22] rec0=15 rec1=00 rec2=17 rec3=07a
        [0x23] rec0=1b rec1=00 rec2=23 rec3=014
        [0x24] rec0=1c rec1=00 rec2=18 rec3=03a
        [0x25] rec0=17 rec1=00 rec2=1a rec3=03e
        [0x26] rec0=25 rec1=00 rec2=1b rec3=034
        [0x27] rec0=24 rec1=00 rec2=1c rec3=002
        [0x28] rec0=1f rec1=00 rec2=1d rec3=030
        [0x29] rec0=1c rec1=00 rec2=22 rec3=00e
        [0x2a] rec0=00 rec1=00 rec2=21 rec3=002
        [0x2b] rec0=1c rec1=00 rec2=1e rec3=02e
        [0x2c] rec0=1e rec1=00 rec2=1f rec3=020
        [0x2d] rec0=2a rec1=00 rec2=20 rec3=040
        [0x2e] rec0=1b rec1=00 rec2=19 rec3=000
        [0x2f] rec0=29 rec1=00 rec2=21 rec3=038
        [0x30] rec0=1a rec1=00 rec2=22 rec3=000
        [0x31] rec0=00 rec1=00 rec2=00 rec3=000
    tail 0x2150ea7de830c6c945f10 0x489e0066482863c01
Free Block Chain:
  0x25: 0000  00 11 00 10 80 03 20 2d 2d 03 00 07 20 20 20 20  ┆       --       ┆
  0x11: 0000  00 32 00 08 80 05 20 49 6e 74 65 05 73 2e 43 68  ┆ 2     Inte s.Ch┆
  0x32: 0000  00 00 00 2e 80 0c 6c 73 20 20 45 52 52 4e 4f 28  ┆   .  ls  ERRNO(┆