|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T V
Length: 33927 (0x8487)
Types: TextFile
Names: »V«
└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
└─⟦124ff5788⟧ »DATA«
└─⟦this⟧
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
└─⟦6f12a12be⟧ »DATA«
└─⟦this⟧
-- 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_information (Errno, "errno");
-- the pragma interface_informations takes subprograms only, so we build a
-- errno function
FUNCTION Errno RETURN Unix_Base_Types.Int;
PRAGMA Interface (C, Errno);
PRAGMA Interface_Information (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_Information (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_Information (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_Information (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_Information (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_Information (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_Information (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_Information (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_Information (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_Information (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_Information (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_Information (Mkrnod, ".mkrnod");
PROCEDURE Sync;
PRAGMA Interface (C, Sync);
PRAGMA Interface_Information (Sync, ".sync");
PROCEDURE Lsync;
-- update super-block
PRAGMA Interface (C, Lsync);
PRAGMA Interface_Information (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_Information (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_Information (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_Information (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_Information (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_Information (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_information (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_Information (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_Information (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_Information (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_Information (Getuid, ".getuid");
FUNCTION Geteuid RETURN Unix_Base_Types.Unsigned_Short;
-- get effective user id GETUID(2)
PRAGMA Interface (C, Geteuid);
PRAGMA Interface_Information (Geteuid, ".geteuid");
FUNCTION Getgid RETURN Unix_Base_Types.Unsigned_Short;
-- get real group id GETUID(2)
PRAGMA Interface (C, Getgid);
PRAGMA Interface_Information (Getgid, ".getgid");
FUNCTION Getegid RETURN Unix_Base_Types.Unsigned_Short;
-- get effective group id GETUID(2)
PRAGMA Interface (C, Getegid);
PRAGMA Interface_Information (Getegid, ".getegid");
FUNCTION Getpid RETURN Unix_Base_Types.Int;
-- get process id GETPID(2)
PRAGMA Interface (C, Getpid);
PRAGMA Interface_Information (Getpid, ".getpid");
FUNCTION Getpgrp RETURN Unix_Base_Types.Int;
-- get process group id GETPID(2)
PRAGMA Interface (C, Getpgrp);
PRAGMA Interface_Information (Getpgrp, ".getpgrp");
FUNCTION Getppid RETURN Unix_Base_Types.Int;
-- get parent process id GETPID(2)
PRAGMA Interface (C, Getppid);
PRAGMA Interface_Information (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_Information (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_Information (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_Information (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_information (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_Information (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_Information (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_information (Execv, "_execv");
--
FUNCTION Fork RETURN Unix_Base_Types.Int;
-- create a new process FORK(2)
PRAGMA Interface (C, Fork);
PRAGMA Interface_Information (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_Information (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_Information (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_Information (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_Information (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_Information (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_Information (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_Information (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_Information (Time, ".time");
FUNCTION Times (Buffer : Tms_Ptr) RETURN Clock_T;
-- Get process and child times
PRAGMA Interface (C, Times);
PRAGMA Interface_Information (Times, ".times");
END Time;
END System_Interface;