1 /* ***********************************************************
 2    *                                                         *
 3    * Copyright, (C) Honeywell Information Systems Inc., 1982 *
 4    *                                                         *
 5    * Copyright (c) 1972 by Massachusetts Institute of        *
 6    * Technology and Honeywell Information Systems, Inc.      *
 7    *                                                         *
 8    *********************************************************** */
 9 
10 
11 set_timax: stm: proc;
12 
13 /* program to set timax to allow higher usage of the processor by the user
14 
15    Usage: set_timax n
16 
17    where "n" is the number of seconds to set timax to.  (A value
18    of "0" will set it to the default: tc_data|timax.)
19 
20    coded by Roger Roach - April 26, 1971
21    modified December, 1978 - P. B. Kelley - to call get_process_id_()
22                                                                       */
23 
24 dcl  arg char (arglen) based (argptr), argptr pointer,
25     (arglen, ret_length, timax) fixed bin,
26      code fixed bin (35),
27      fnum float bin (27),
28      ret_string char (120),
29      ring_0_message char (ret_length) based (addr (ret_string)),
30      bad_char char (1);
31 
32 dcl  cu_$arg_ptr ext entry (fixed bin, ptr, fixed bin, fixed bin (35)),
33      cv_float_ ext entry (char (*), fixed bin (35), float bin (27)),
34      hphcs_$pxss_set_timax ext entry (bit (36), fixed bin),
35     (com_err_, ioa_, ioa_$rs, phcs_$ring_0_message) ext entry options (variable),
36      get_process_id_ ext entry returns (bit(36));
37 dcl  processid bit(36);
38 dcl  linkage_error condition;
39 
40           call cu_$arg_ptr (1, argptr, arglen, code);
41 
42           if code ^= 0 then do;
43                call com_err_ (code, "set_timax");
44                return;
45           end;
46 
47           call cv_float_ (arg, code, fnum);
48 
49           if code ^= 0 then do;
50                bad_char = substr (arg, code, 1);
51                call com_err_ (0, "set_timax", "illegal character ""^a"" in argument ""^a"".", bad_char, arg);
52                return;
53           end;
54 
55           timax = fnum * 1000000;
56 
57           if timax > 0
58                then call ioa_ ("setting timax to ^.1f seconds.", fnum);
59                else call ioa_ ("resetting timax to default.");
60 
61           processid = get_process_id_ ();
62 
63           on linkage_error begin;
64                revert linkage_error;
65                call com_err_ (0, "set_timax", "Insufficient access to reset timax.");
66                go to out;
67           end;
68 
69           call hphcs_$pxss_set_timax (processid, timax);
70 
71           revert linkage_error;
72 
73           if timax > 0 then do;
74                call ioa_$rs ("setting timax to ^.1f seconds.", ret_string, ret_length, fnum);
75                call phcs_$ring_0_message (ring_0_message);
76           end;
77           else call phcs_$ring_0_message ("setting timax to default.");
78 
79 out:
80           return;
81 
82      end;