?? LEFT := 1, RIGHT := 110 ??
MODULE tcm$engineering_log_support;

{
{ Purpose: This module allows a caller executing in Ring 6 or below to activate
{ an engineering log and write a statistic to it without requiring the caller
{ to have SOU CA (CONFIGURATION_ADMINISTRATION) privilege.  In addition to
{ running at or below Ring 6, the caller's login family and login user must both
{ be $SYSTEM.
{

?? PUSH (LISTEXT := ON) ??
*copyc jmc$system_family
*copyc osp$set_status_abnormal
*copyc ost$caller_identifier
*copyc ost$user_identification
*copyc rme$robotic_interface_errors
?? POP ??

?? NEWTITLE := 'Global Procedures Referenced by this Module', EJECT ??
*copyc pmp$get_user_identification
*copyc sfp$activate_system_statistic

?? OLDTITLE ??
?? NEWTITLE := ' tcp$activate_hpa_logging', EJECT ??

  PROCEDURE [#GATE, XDCL] tcp$activate_hpa_logging
    (    statistic_code: sft$statistic_code;
     VAR status: ost$status);

    VAR
      caller_id: ost$caller_identifier,
      user_id: ost$user_identification;

    #CALLER_ID (caller_id);

    pmp$get_user_identification (user_id, status);

    IF status.normal THEN
      IF (caller_id.ring > osc$sj_ring_3 {ring 6}) OR
            (user_id.family <> jmc$system_family) OR (user_id.user <> jmc$system_user) THEN
        osp$set_status_abnormal (rmc$resource_management_id, rme$invalid_server_response, '', status);
      ELSE
        sfp$activate_system_statistic (statistic_code, $sft$binary_logset[pmc$engineering_log], status);
      IFEND;
    IFEND;

  PROCEND tcp$activate_hpa_logging;
MODEND tcm$engineering_log_support;
