1 /****^  ***********************************************************
 2         *                                                         *
 3         * Copyright, (C) Honeywell Bull Inc., 1987                *
 4         *                                                         *
 5         * Copyright, (C) Honeywell Information Systems Inc., 1982 *
 6         *                                                         *
 7         * Copyright (c) 1972 by Massachusetts Institute of        *
 8         * Technology and Honeywell Information Systems, Inc.      *
 9         *                                                         *
10         *********************************************************** */
11 
12 
13 /* format: style4,delnl,insnl,indattr,ifthen,dclind10 */
14 add_key:
15      proc (p_journal_control_block_ptr, p_info_ptr, p_code);
16 
17 /* After doing the specified add_key operation on the vfile, an entry is made
18    in the journal recording the key and descriptor.  Only the input_desc and input_key case is allowed.
19 
20    Written  by  Lindsey Spratt 08/06/79
21    Modified by Chris Jones 02/15/85 for privileges and clean up.
22 */
23 /* Parameter */
24 
25 
26 dcl       p_journal_control_block_ptr
27                                  ptr;
28 dcl       p_info_ptr             ptr;
29 dcl       p_code                 fixed bin (35);
30 
31 /* Automatic */
32 
33 dcl       privileges_string      bit (36) aligned;
34 
35 /* Based */
36 /* Controlled */
37 /* Builtin */
38 
39 dcl       null                   builtin;
40 
41 dcl       cleanup                condition;
42 
43 /* Entry */
44 
45 dcl       iox_$control           entry (ptr, char (*), ptr, fixed bin (35));
46 dcl       rcprm_registry_util_$turn_off_privs
47                                  entry (bit (36) aligned);
48 dcl       rcprm_registry_util_$turn_on_privs
49                                  entry (bit (36) aligned);
50 
51 /* External */
52 
53 dcl       error_table_$locked_by_this_process
54                                  fixed bin (35) ext;
55 dcl       error_table_$bad_arg   fixed bin (35) ext;
56 ^L
57           ak_info_ptr = p_info_ptr;
58           journal_control_block_ptr = p_journal_control_block_ptr;
59           if ^ak_info.input_desc & ^ak_info.input_key then do;
60                p_code = error_table_$bad_arg;
61                return;
62           end;
63           privileges_string = ""b;
64           on cleanup call rcprm_registry_util_$turn_off_privs (privileges_string);
65 
66           call rcprm_registry_util_$turn_on_privs (privileges_string);
67           call iox_$control (journal_control_block.vfile_iocb_ptr, "add_key", ak_info_ptr, p_code);
68           if p_code ^= 0 & p_code ^= error_table_$locked_by_this_process then do;
69                call rcprm_registry_util_$turn_off_privs (privileges_string);
70                return;
71           end;
72 
73           a_key_len = ak_info.key_len;
74           a_rec_len = 0;
75           alloc journal_entry in (journal_area);
76           journal_entry.key_str = ak_info.key;
77           journal_entry.descriptor = ak_info.descrip;
78           journal_entry.inc_ref_count = "0"b;
79           journal_entry.dec_ref_count = "0"b;
80           journal_entry.type = ADD_KEY;
81           journal_entry.next_ptr = null;
82           if journal_control_block.latest_entry_ptr ^= null then
83                journal_control_block.latest_entry_ptr -> journal_entry.next_ptr = journal_entry_ptr;
84           journal_entry.prev_ptr = journal_control_block.latest_entry_ptr;
85           journal_control_block.latest_entry_ptr = journal_entry_ptr;
86           call rcprm_registry_util_$turn_off_privs (privileges_string);
87           return;
88 ^L
89 %include journal_entry;
90 %include journal_control_block;
91 %include ak_info;
92 
93      end add_key;