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

⟦10b6b2e2f⟧ Ada Source

    Length: 38912 (0x9800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package System_Interface, seg_052ab1

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦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 Interface_Name (Errno, "errno");

        -- the pragma interface_names takes subprograms only, so we build a
        -- errno function
        -- function Errno return Unix_Base_Types.Int;
        -- pragma Interface (C, Errno);
        -- pragma Interface_Name (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#0000400#;   -- 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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (Mkrnod, ".mkrnod");


        procedure Sync;
        pragma Interface (C, Sync);
        pragma Interface_Name (Sync, ".sync");


        procedure Lsync;
        -- update super-block
        pragma Interface (C, Lsync);
        pragma Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 interface_name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (Getuid, ".getuid");



        function Geteuid return Unix_Base_Types.Unsigned_Short;
        -- get effective user id  GETUID(2)
        pragma Interface (C, Geteuid);
        pragma Interface_Name (Geteuid, ".geteuid");



        function Getgid return Unix_Base_Types.Unsigned_Short;
        -- get real group id  GETUID(2)
        pragma Interface (C, Getgid);
        pragma Interface_Name (Getgid, ".getgid");



        function Getegid return Unix_Base_Types.Unsigned_Short;
        -- get effective group id  GETUID(2)
        pragma Interface (C, Getegid);
        pragma Interface_Name (Getegid, ".getegid");



        function Getpid return Unix_Base_Types.Int;
        -- get process id  GETPID(2)
        pragma Interface (C, Getpid);  
        pragma Interface_Name (Getpid, ".getpid");



        function Getpgrp return Unix_Base_Types.Int;
        -- get process group id  GETPID(2)
        pragma Interface (C, Getpgrp);
        pragma Interface_Name (Getpgrp, ".getpgrp");



        function Getppid return Unix_Base_Types.Int;
        -- get parent process id  GETPID(2)
        pragma Interface (C, Getppid);  
        pragma Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 interface_name (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 Interface_Name (Exit_Status, ".F_Exit_Status");


        procedure Ext (Status : in Unix_Base_Types.Int);
        -- exit or terminate process  EXIT(2)
        pragma Interface (C, Ext);
        pragma Interface_Name (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 interface_name (Execv, "_execv");
--


        function Fork return Unix_Base_Types.Int;
        -- create a new process  FORK(2)
        pragma Interface (C, Fork);
        pragma Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (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 Interface_Name (Time, ".time");



        function Times (Buffer : Tms_Ptr) return Clock_T;
        -- Get process and child times
        pragma Interface (C, Times);
        pragma Interface_Name (Times, ".times");

    end Time;


end System_Interface;

E3 Meta Data

    nblk1=25
    nid=25
    hdr6=48
        [0x00] rec0=1e rec1=00 rec2=01 rec3=038
        [0x01] rec0=18 rec1=00 rec2=02 rec3=074
        [0x02] rec0=17 rec1=00 rec2=03 rec3=048
        [0x03] rec0=13 rec1=00 rec2=08 rec3=010
        [0x04] rec0=11 rec1=00 rec2=07 rec3=022
        [0x05] rec0=13 rec1=00 rec2=06 rec3=01e
        [0x06] rec0=10 rec1=00 rec2=05 rec3=066
        [0x07] rec0=15 rec1=00 rec2=04 rec3=09c
        [0x08] rec0=17 rec1=00 rec2=09 rec3=078
        [0x09] rec0=0e rec1=00 rec2=0a rec3=06a
        [0x0a] rec0=14 rec1=00 rec2=0b rec3=07e
        [0x0b] rec0=17 rec1=00 rec2=0c rec3=030
        [0x0c] rec0=0f rec1=00 rec2=0d rec3=02c
        [0x0d] rec0=17 rec1=00 rec2=0e rec3=03e
        [0x0e] rec0=19 rec1=00 rec2=0f rec3=09e
        [0x0f] rec0=1f rec1=00 rec2=10 rec3=014
        [0x10] rec0=17 rec1=00 rec2=11 rec3=02a
        [0x11] rec0=1c rec1=00 rec2=12 rec3=02e
        [0x12] rec0=1b rec1=00 rec2=13 rec3=064
        [0x13] rec0=18 rec1=00 rec2=14 rec3=036
        [0x14] rec0=1d rec1=00 rec2=16 rec3=026
        [0x15] rec0=17 rec1=00 rec2=15 rec3=020
        [0x16] rec0=15 rec1=00 rec2=17 rec3=054
        [0x17] rec0=16 rec1=00 rec2=18 rec3=050
        [0x18] rec0=18 rec1=00 rec2=19 rec3=03a
        [0x19] rec0=1c rec1=00 rec2=1a rec3=042
        [0x1a] rec0=16 rec1=00 rec2=1b rec3=00e
        [0x1b] rec0=20 rec1=00 rec2=1c rec3=040
        [0x1c] rec0=22 rec1=00 rec2=1d rec3=000
        [0x1d] rec0=1f rec1=00 rec2=1e rec3=070
        [0x1e] rec0=1a rec1=00 rec2=1f rec3=02e
        [0x1f] rec0=1d rec1=00 rec2=20 rec3=066
        [0x20] rec0=19 rec1=00 rec2=21 rec3=036
        [0x21] rec0=1d rec1=00 rec2=22 rec3=014
        [0x22] rec0=28 rec1=00 rec2=24 rec3=03e
        [0x23] rec0=1a rec1=00 rec2=23 rec3=001
        [0x24] rec0=00 rec1=00 rec2=00 rec3=00c
    tail 0x21759fe4087a14f28001c 0x42a00088462060003
Free Block Chain:
  0x25: 0000  00 00 03 e7 80 14 20 6f 6e 6c 79 2c 20 73 6f 20  ┆       only, so ┆