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

⟦18e983d81⟧ Ada Source

    Length: 5120 (0x1400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Run_Cmd, seg_00f333

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



with Io;
with Log;
with Profile;
with Program;
with Calendar;
with Debug_Tools;
with Simple_Status;
with Io_Exceptions;
with String_Utilities;
with System_Utilities;
with Remote_Operations;

procedure Run_Cmd (On_Host : String := ""; Id : Integer; Depth : Natural) is

    package Su renames String_Utilities;
    package Ro renames Remote_Operations;

    Max_Seconds : constant := 360;

    Context : Ro.Context;
    Status : Ro.Error_Status;

    function Log_File return String is
    begin
        return On_Host & '_' & Su.Strip (Integer'Image (Id)) &
                  '_' & Su.Strip (Natural'Image (Depth));
    end Log_File;

    function Job_Image return String is
    begin
        return "Run_Cmd (On_Host => """ & On_Host &
                  """, Id =>" & Integer'Image (Id) &
                  ", Depth =>" & Natural'Image (Depth - 1) & ')';
    end Job_Image;

    function Pseudo_Random (Kind : String) return Duration is
        A_Number : Long_Integer;
        Ignored : Long_Integer;
        Result : Long_Integer;
    begin
        -- Processor_Manager.Get_Time_Info (Time_Since_Ipl => A_Number,
        --                                  Time_Of_Ipl => Ignored,
        --                                  Ticks_Per_Second => Ignored);
        A_Number := Long_Integer
                       (Calendar."-" (Calendar.Clock,
                                      System_Utilities.System_Up_Time));
        Result := A_Number mod Max_Seconds;
        Log.Put_Line ("Delay for " & Kind & " is" &
                      Long_Integer'Image (Result) & " seconds",
                      Kind => Profile.Note_Msg);
        Log.Flush;
        return Duration (Result);
    end Pseudo_Random;

    procedure Check (Status : Ro.Error_Status) is
    begin
        if Simple_Status.Error (Status) then
            Log.Put_Condition (Status);
            Log.Flush;
            raise Profile.Error;
        else
            Log.Flush;
        end if;
    end Check;

    procedure Spawn_Child is
    begin
        if Depth > 0 then
            Program.Run_Job (S => Job_Image,
                             After => Pseudo_Random ("job start"));
        end if;
    end Spawn_Child;

begin
    loop
        begin
            Log.Set_Output (Log_File);
            exit;
        exception
            when Io_Exceptions.Use_Error =>
                delay 1.0;
        end;
    end loop;


    Ro.Acquire (A_Context => Context,
                Status => Status,
                Machine => On_Host,
                Instance => "");
    Check (Status);

    Ro.Execute (Command => "pwd",
                In_Context => Context,
                Status => Status,
                Timeout => Remote_Operations.Wait_Forever);
    Check (Status);

    Ro.Execute (Command => "ls -alg",
                In_Context => Context,
                Status => Status,
                Timeout => Remote_Operations.Wait_Forever);
    Check (Status);

    Ro.Execute (Command => "ps -ax",
                In_Context => Context,
                Status => Status,
                Timeout => Remote_Operations.Wait_Forever);
    Check (Status);

    Ro.Release (A_Context => Context,
                Status => Status,
                Idle_Timeout => Remote_Operations.Default);
    Check (Status);

    Spawn_Child;
    delay Pseudo_Random ("termination");
exception
    when Profile.Error =>
        Spawn_Child;

    when others =>
        Log.Put_Line ("Got unexpected exception " &
                      Debug_Tools.Get_Exception_Name (Machine_Info => True),
                      Kind => Profile.Exception_Msg);
end Run_Cmd;

E3 Meta Data

    nblk1=4
    nid=0
    hdr6=8
        [0x00] rec0=26 rec1=00 rec2=01 rec3=008
        [0x01] rec0=18 rec1=00 rec2=02 rec3=00c
        [0x02] rec0=27 rec1=00 rec2=03 rec3=03c
        [0x03] rec0=1a rec1=00 rec2=04 rec3=000
    tail 0x2170bb9da822a65d487cd 0x42a00088462060003