DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T V

⟦fac7ca86b⟧ TextFile

    Length: 39685 (0x9b05)
    Types: TextFile
    Names: »V«

Derivation

└─⟦bad92a95e⟧ Bits:30000535 8mm tape, Rational 1000, RPC 1_0_2
    └─ ⟦bb34fe6e2⟧ »DATA« 
        └─⟦15d8b76c6⟧ 
            └─⟦this⟧ 

TextFile

--    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;
        -- 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 := 226;      -- 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

    private

        pragma Import_Object (Internal => Errno, External => "_errno");

    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#;             -- read,write, 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#;             -- read, write,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#;    -- read, write, 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

        function Chmod (Path : Unix_Base_Types.Char_Ptr; Mode : Mode_T)
                       return Unix_Base_Types.Int;
        -- change access mode of file  CHMOD(2)

        function Fchmod (Fildes : Unix_Base_Types.Int; Mode : Mode_T)
                        return Unix_Base_Types.Int;
        -- change access mode of file  CHMOD(2)

        function Stat (Path : Unix_Base_Types.Char_Ptr; Buf : Stat_Ptr)
                      return Unix_Base_Types.Int;
        -- get file status  STAT(2)

        function Lstat (Path : Unix_Base_Types.Char_Ptr; Buf : Stat_Ptr)
                       return Unix_Base_Types.Int;
        -- get file status  STAT(2)

        function Fstat (Fildes : Unix_Base_Types.Int; Buf : Stat_Ptr)
                       return Unix_Base_Types.Int;
        -- get file status  STAT(2)

        function Accss (Path : Unix_Base_Types.Char_Ptr;
                        Amode : Unix_Base_Types.Int) return Unix_Base_Types.Int;
        -- determine accessibility of a file  ACCESS(2)

        function Chown (Path : Unix_Base_Types.Char_Ptr;
                        Owner : Unix_Base_Types.Int;
                        Group : Unix_Base_Types.Int) return Unix_Base_Types.Int;
        -- change owner and group of a file  CHOWN(2)

        function Fchown (Fd : Unix_Base_Types.Int;
                         Owner : Unix_Base_Types.Int;
                         Group : Unix_Base_Types.Int)
                        return Unix_Base_Types.Int;
        -- change owner and group of a file  CHOWN(2)

        function Fcntl (Fildes : Unix_Base_Types.Int;
                        Cmd : Unix_Base_Types.Int;
                        Arg : Flock_Ptr) return Unix_Base_Types.Int;
        -- File control

        function Lseek (Fildes : Unix_Base_Types.Int;
                        Offset : Unix_Base_Types.Long;
                        Whence : Unix_Base_Types.Int)
                       return Unix_Base_Types.Long;
        -- move read/write file pointer; seek  LSEEK(2)

        function Mknod (Path : Unix_Base_Types.Char_Ptr;
                        Mode : Mode_T;
                        Dev : Dev_T) return Unix_Base_Types.Int;

        -- make a directory , or a special or regular file; see MKNOD(2)

        function Mkrnod (Path : Unix_Base_Types.Char_Ptr;
                         Mode : Unix_Base_Types.Int;
                         Dev : Unix_Base_Types.Long;
                         Cnodeid : Unix_Base_Types.Long)
                        return Unix_Base_Types.Int;

        -- make a device file that can be access from a differenet cnode

        procedure Sync;
        procedure Lsync;

        -- update super-block

        function Umask (Cmask : Mode_T) return Mode_T;

        -- Set and get file creation mask
    private

        pragma Interface (C, Chmod);
        pragma Import_Function
           (Internal => Chmod,
            External => "_chmod",
            Parameter_Types => (Unix_Base_Types.Char_Ptr, Mode_T),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value));

        pragma Interface (C, Fchmod);
        pragma Import_Function
           (Internal => Fchmod,
            External => "_fchmod",
            Parameter_Types => (Unix_Base_Types.Int, Mode_T),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value));

        pragma Interface (C, Mknod);
        pragma Import_Function
           (Internal => Mknod,
            External => "_mknod",
            Parameter_Types => (Unix_Base_Types.Char_Ptr, Mode_T, Dev_T),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value, Value));

        pragma Interface (C, Mkrnod);
        pragma Import_Function
           (Internal => Mkrnod,
            External => "_mkrnod",
            Parameter_Types => (Unix_Base_Types.Char_Ptr, Unix_Base_Types.Int,
                                Unix_Base_Types.Long, Unix_Base_Types.Long),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value, Value, Value));
        pragma Interface (C, Stat);
        pragma Import_Function
           (Internal => Stat,
            External => "_stat",
            Parameter_Types => (Unix_Base_Types.Char_Ptr, Stat_Ptr),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value));

        pragma Interface (C, Lstat);
        pragma Import_Function
           (Internal => Lstat,
            External => "_lstat",
            Parameter_Types => (Unix_Base_Types.Char_Ptr, Stat_Ptr),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value));

        pragma Interface (C, Fstat);
        pragma Import_Function
           (Internal => Fstat,
            External => "_fstat",
            Parameter_Types => (Unix_Base_Types.Int, Stat_Ptr),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value));

        pragma Interface (C, Accss);
        pragma Import_Function
           (Internal => Accss,
            External => "_access",
            Parameter_Types => (Unix_Base_Types.Char_Ptr, Unix_Base_Types.Int),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value));

        pragma Interface (C, Chown);
        pragma Import_Function
           (Internal => Chown,
            External => "_chown",
            Parameter_Types => (Unix_Base_Types.Char_Ptr,
                                Unix_Base_Types.Int, Unix_Base_Types.Int),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value, Value));

        pragma Interface (C, Fchown);
        pragma Import_Function
           (Internal => Fchown,
            External => "_fchown",
            Parameter_Types => (Unix_Base_Types.Int, Unix_Base_Types.Int,
                                Unix_Base_Types.Int),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value, Value));

        pragma Interface (C, Fcntl);
        pragma Import_Function
           (Internal => Fcntl,
            External => "_fcntl",
            Parameter_Types => (Unix_Base_Types.Int,
                                Unix_Base_Types.Int, Flock_Ptr),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value, Value));
        pragma Interface (C, Lseek);
        pragma Import_Function
           (Internal => Lseek,
            External => "_lseek",
            Parameter_Types => (Unix_Base_Types.Int, Unix_Base_Types.Long,
                                Unix_Base_Types.Int),
            Result_Type => Unix_Base_Types.Long,
            Mechanism => (Value, Value, Value));
        pragma Interface (C, Sync);
        pragma Import_Procedure (Internal => Sync, External => "_sync");
        pragma Interface (C, Lsync);
        pragma Import_Procedure (Internal => Lsync, External => "_lsync");

        pragma Interface (C, Umask);
        pragma Import_Function (Internal => Umask,
                                External => "_umask",
                                Parameter_Types => (Mode_T),
                                Result_Type => Mode_T,
                                Mechanism => (Value));
    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#;

        Iocsize_Mask : constant := 16#3FFF0000#;-- passed argument size in bytes
        Iocparm_Mask : constant := 16#3FFF#;
        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;

        function Creat (Path : Unix_Base_Types.Char_Ptr; Mode : Mode_T)
                       return Unix_Base_Types.Int;
        -- create a new file or rewrite an existing one  CREAT(2)

        function Read (Fildes : Unix_Base_Types.Int;
                       Buf : Unix_Base_Types.Char_Ptr;
                       Nbyte : Unix_Base_Types.Unsigned)
                      return Unix_Base_Types.Int;
        -- read input  READ(2)

        function Write (Fildes : Unix_Base_Types.Int;
                        Buf : Unix_Base_Types.Char_Ptr;
                        Nbyte : Unix_Base_Types.Unsigned)
                       return Unix_Base_Types.Int;
        -- write on a file  WRITE(2)

        function Rename (Source : Unix_Base_Types.Char_Ptr;
                         Target : Unix_Base_Types.Char_Ptr)
                        return Unix_Base_Types.Int;
        -- change the name of a file  RENAME(2)

        function Open (Path : Unix_Base_Types.Char_Ptr;
                       Oflag : Unix_Base_Types.Int) return Unix_Base_Types.Int;
        -- open file for reading or writing  OPEN(2)

        function Open (Path : Unix_Base_Types.Char_Ptr;
                       Oflag : Unix_Base_Types.Int;
                       Mode : Mode_T) return Unix_Base_Types.Int;
        -- open file for reading or writing  OPEN(2)

        function Close (Fildes : Unix_Base_Types.Int)
                       return Unix_Base_Types.Int;
        -- close a file descriptor  CLOSE(2)

        function Ioctl (Fildes : Unix_Base_Types.Int;
                        Request : Unix_Base_Types.Int;
                        Arg : Unix_Base_Types.Int) return Unix_Base_Types.Int;
        -- control device  IOCTL(2)


    private

        pragma Interface (C, Creat);
        pragma Import_Function
           (Internal => Creat,
            External => "_creat",
            Parameter_Types => (Unix_Base_Types.Char_Ptr, Mode_T),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value));

        pragma Interface (C, Read);
        pragma Import_Function
           (Internal => Read,
            External => "_read",
            Parameter_Types => (Unix_Base_Types.Int, Unix_Base_Types.Char_Ptr,
                                Unix_Base_Types.Unsigned),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value, Value));

        pragma Interface (C, Write);
        pragma Import_Function
           (Internal => Write,
            External => "_write",
            Parameter_Types => (Unix_Base_Types.Int, Unix_Base_Types.Char_Ptr,
                                Unix_Base_Types.Unsigned),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value, Value));

        pragma Interface (C, Rename);
        pragma Import_Function (Internal => Rename,
                                External => "_rename",
                                Parameter_Types => (Unix_Base_Types.Char_Ptr,
                                                    Unix_Base_Types.Char_Ptr),
                                Result_Type => Unix_Base_Types.Int,
                                Mechanism => (Value, Value));

        pragma Interface (C, Open);
        pragma Import_Function
           (Internal => Open,
            External => "_open",
            Parameter_Types => (Unix_Base_Types.Char_Ptr, Unix_Base_Types.Int),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value));

        pragma Import_Function
           (Internal => Open,
            External => "_open",
            Parameter_Types =>
               (Unix_Base_Types.Char_Ptr, Unix_Base_Types.Int, Mode_T),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value, Value));

        pragma Interface (C, Close);
        pragma Import_Function (Internal => Close,
                                External => "_close",
                                Parameter_Types => (Unix_Base_Types.Int),
                                Result_Type => Unix_Base_Types.Int,
                                Mechanism => (Value));

        pragma Interface (C, Ioctl);
        pragma Import_Function
           (Internal => Ioctl,
            External => "_ioctl",
            Parameter_Types => (Unix_Base_Types.Int, Unix_Base_Types.Int,
                                Unix_Base_Types.Int),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value, Reference));

    end File_Io;

    package Ids is

        function Getuid return Unix_Base_Types.Unsigned_Short;
        -- get real user id  GETUID(2)

        function Geteuid return Unix_Base_Types.Unsigned_Short;
        -- get effective user id  GETUID(2)

        function Getgid return Unix_Base_Types.Unsigned_Short;
        -- get real group id  GETUID(2)

        function Getegid return Unix_Base_Types.Unsigned_Short;
        -- get effective group id  GETUID(2)

        function Getpid return Unix_Base_Types.Int;
        -- get process id  GETPID(2)

        function Getpgrp return Unix_Base_Types.Int;
        -- get process group id  GETPID(2)

        function Getppid return Unix_Base_Types.Int;
        -- get parent process id  GETPID(2)

        function Getpgrp2 (Pid : Unix_Base_Types.Int)
                          return Unix_Base_Types.Int;
        -- get process group id of the specified process  GETPID(2)

        function Setuid (Uid : Unix_Base_Types.Int) return Unix_Base_Types.Int;
        -- set user ID  SETUID(2)

        function Setgid (Gid : Unix_Base_Types.Int) return Unix_Base_Types.Int;
        -- set group ID  SETUID(2)

    private

        pragma Interface (C, Getuid);
        pragma Import_Function (Internal => Getuid, External => "_getuid");

        pragma Interface (C, Geteuid);
        pragma Import_Function (Internal => Geteuid, External => "_geteuid");

        pragma Interface (C, Getgid);
        pragma Import_Function (Internal => Getgid, External => "_getgid");

        pragma Interface (C, Getegid);
        pragma Import_Function (Internal => Getegid, External => "_getegid");

        pragma Interface (C, Getpid);
        pragma Import_Function (Internal => Getpid, External => "_getpid");

        pragma Interface (C, Getpgrp);
        pragma Import_Function (Internal => Getpgrp, External => "_getpgrp");

        pragma Interface (C, Getppid);
        pragma Import_Function (Internal => Getppid, External => "_getppid");

        pragma Interface (C, Getpgrp2);
        pragma Import_Function (Internal => Getpgrp2,
                                External => "_getpgrp2",
                                Parameter_Types => (Unix_Base_Types.Int),
                                Result_Type => Unix_Base_Types.Int,
                                Mechanism => (Value));

        pragma Interface (C, Setuid);
        pragma Import_Function (Internal => Setuid,
                                External => "_setuid",
                                Parameter_Types => (Unix_Base_Types.Int),
                                Result_Type => Unix_Base_Types.Int,
                                Mechanism => (Value));

        pragma Interface (C, Setgid);
        pragma Import_Function (Internal => Setgid,
                                External => "_setgid",
                                Parameter_Types => (Unix_Base_Types.Int),
                                Result_Type => Unix_Base_Types.Int,
                                Mechanism => (Value));

    end Ids;

    package Process is

        Exit_Status : Unix_Base_Types.Int;
        -- The runtime system returns this value when exiting the
        -- Ada program.  The runtime system uses 0 by default.

        procedure Ext (Status : Unix_Base_Types.Int);
        -- exit or terminate process  EXIT(2)

        function Execv (Path : Unix_Base_Types.Char_Ptr;
                        Argv : Unix_Base_Types.Char_Ptrs)
                       return Unix_Base_Types.Int;

        -- Execute a file

        function Fork return Unix_Base_Types.Int;
        -- create a new process  FORK(2)

        function Kill (Pid : Unix_Base_Types.Int; Sig : Unix_Base_Types.Int)
                      return Unix_Base_Types.Int;
        -- send a signal to a process or a group of processes  KILL(2)

    private

        pragma Import_Object (Internal => Exit_Status,
                              External => "__EXIT_STATUS");

        pragma Interface (C, Ext);
        pragma Import_Procedure (Internal => Ext,
                                 External => "_exit",
                                 Parameter_Types => (Unix_Base_Types.Int),
                                 Mechanism => (Value));

        pragma Interface (C, Execv);
        pragma Import_Function (Internal => Execv,
                                External => "_execv",
                                Parameter_Types => (Unix_Base_Types.Char_Ptr,
                                                    Unix_Base_Types.Char_Ptrs),
                                Result_Type => Unix_Base_Types.Int,
                                Mechanism => (Value, Reference));
        pragma Interface (C, Fork);
        pragma Import_Function (Internal => Fork, External => "_fork");

        pragma Interface (C, Kill);
        pragma Import_Function
           (Internal => Kill,
            External => "_kill",
            Parameter_Types => (Unix_Base_Types.Int, Unix_Base_Types.Int),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value));

    end Process;

    package Shell is

        subtype Mode_T is System_Interface.File_Access.Mode_T;

        function Mkdir (Path : Unix_Base_Types.Char_Ptr; Mode : Mode_T)
                       return Unix_Base_Types.Int;
        -- make a directory file  MKDIR(2)

        function Chdir (Path : Unix_Base_Types.Char_Ptr)
                       return Unix_Base_Types.Int;
        -- change working directory  CHDIR(2)

        function Chroot (Path : Unix_Base_Types.Char_Ptr)
                        return Unix_Base_Types.Int;
        -- change root directory  CHROOT(2)

        function Link (Path1 : Unix_Base_Types.Char_Ptr;
                       Path2 : Unix_Base_Types.Char_Ptr)
                      return Unix_Base_Types.Int;
        -- link to a file  LINK(2)

        function Rmdir (Path : Unix_Base_Types.Char_Ptr)
                       return Unix_Base_Types.Int;
        -- remove a directory file  RMDIR(2)

        function Unlink (Path : Unix_Base_Types.Char_Ptr)
                        return Unix_Base_Types.Int;
        -- remove directory entry; delete file  UNLINK(2)

    private

        pragma Interface (C, Mkdir);
        pragma Import_Function
           (Internal => Mkdir,
            External => "_mkdir",
            Parameter_Types => (Unix_Base_Types.Char_Ptr, Mode_T),
            Result_Type => Unix_Base_Types.Int,
            Mechanism => (Value, Value));

        pragma Interface (C, Chdir);
        pragma Import_Function (Internal => Chdir,
                                External => "_chdir",
                                Parameter_Types => (Unix_Base_Types.Char_Ptr),
                                Result_Type => Unix_Base_Types.Int,
                                Mechanism => (Value));

        pragma Interface (C, Chroot);
        pragma Import_Function (Internal => Chroot,
                                External => "_chroot",
                                Parameter_Types => (Unix_Base_Types.Char_Ptr),
                                Result_Type => Unix_Base_Types.Int,
                                Mechanism => (Value));

        pragma Interface (C, Link);
        pragma Import_Function (Internal => Link,
                                External => "_link",
                                Parameter_Types => (Unix_Base_Types.Char_Ptr,
                                                    Unix_Base_Types.Char_Ptr),
                                Result_Type => Unix_Base_Types.Int,
                                Mechanism => (Value, Value));

        pragma Interface (C, Rmdir);
        pragma Import_Function (Internal => Rmdir,
                                External => "_rmdir",
                                Parameter_Types => (Unix_Base_Types.Char_Ptr),
                                Result_Type => Unix_Base_Types.Int,
                                Mechanism => (Value));

        pragma Interface (C, Unlink);
        pragma Import_Function (Internal => Unlink,
                                External => "_unlink",
                                Parameter_Types => (Unix_Base_Types.Char_Ptr),
                                Result_Type => Unix_Base_Types.Int,
                                Mechanism => (Value));

    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)

        function Times (Buffer : Tms_Ptr) return Clock_T;
        -- Get process and child times

    private

        pragma Interface (C, Time);
        pragma Import_Function (Internal => Time,
                                External => "_time",
                                Parameter_Types => (Unix_Base_Types.Long_Ptr),
                                Result_Type => Unix_Base_Types.Long,
                                Mechanism => (Value));

        pragma Interface (C, Times);
        pragma Import_Function (Internal => Times,
                                External => "_times",
                                Parameter_Types => (Tms_Ptr),
                                Result_Type => Clock_T,
                                Mechanism => (Value));
    end Time;

end System_Interface;