program pt c c NU PRIME TIME FACILITY V 2.0 c Northeastern University Academic Computer Services c 360 Huntington Avenue c Boston, Mass 02115 c c David Bernardo, Author c c*********************** c File names must be recoded as appropriate c*********************** c c This program allows a user to "ask" how much time remains for c a controlled terminal session. c c Note: Labeled common COMMON also defined in MACRO routine c COUNTUSER.MAR - any changes must be coordinated in c both files. c common /common/me,terminal,grp,logintime,def_sysgrp byte me(12),terminal(7),logintime(8),user_key(14) character username*12,term*7,location*20,tty*4 integer*2 count,count_user,login_status,time_togo, 1 user_status,terminal_status,cluster_status,user_slice, 2 terminal_slice,cluster_slice,cluster_num,def_slice, 3 def_wait_time,def_threshold,def_sysgrp,max_slice, 4 time_buff(2),user_wait_time,loc,time_slice,grp, 5 sys_priv_grp,lim_priv_grp,num_logins integer*4 return_code,sys$gettim,login_time(2) real*8 logout_time,current_time,time_diff,wait_time,login equivalence (me,username) equivalence (terminal,term) equivalence (logintime,login_time(1)) equivalence (user_key(1),username) equivalence (user_key(13),cluster_num) c user_status=1 user_wait_time=0 user_slice=0 c c First get default PRIME TIME values. c open(unit=4,file='manager:[ptdata]ptdefault.dat', 1 err=998,status='old',readonly,shared,form='unformatted') read(4,err=998,end=998)def_slice,def_wait_time,def_threshold, 1 def_sysgrp,sys_priv_grp,lim_priv_grp,num_logins close(unit=4) c c Get pertinent info about current process into COMMON block c count=count_user() if(count.eq.0)then print 16 call exit endif loc=index(username,' ')-1 c c From the terminal file, find out which cluster the current c process's terminal is in. c open(unit=2,file='manager:[ptdata]ptterm.dat',readonly, 1 status='old',access='keyed',recl=3,form='unformatted', 2 organization='indexed',shared,key=(1:4:character),err=998) read(2,key=term(1:4),err=21) 1 tty,cluster_num,terminal_status,terminal_slice close(unit=2) c c And then, from the cluster file, glean appropriate info about c the terminal cluster the user is in. c Note that the the file is .TMP, which is the dynamic cluster data file, c as opposed to the permanent data file for clusters. c open(unit=8,file='manager:[ptdata]ptcluster.tmp', 1 status='old',access='keyed',recl=7,form='unformatted', 2 organization='indexed',shared,key=(1:2:integer), 3 readonly,err=998) read(8,key=cluster_num,err=998) 1 cluster_num,cluster_status,cluster_slice,location close(unit=8) c c Finally, get needed info about user from the user data base. c open(unit=1,file='manager:[ptdata]ptuser.dat', 1 status='old',access='keyed',recl=7,form='unformatted', 2 organization='indexed',shared,readonly, 3 key=(1:14:character,15:16:integer),err=998) read(1,key=user_key,keyid=0,err=11)username,cluster_num, 1 user_status,logout_time,user_wait_time,user_slice 11 close(unit=1) c c If status from user data base show immune, so report and exit. c if(user_status.eq.0)then print 16 16 format(9x,'PT This Username is immune to Prime Time.') call exit endif c c The terminal itself could be immune to PRIME TIME monitoring. c if(terminal_status.eq.0)then 21 print 22 22 format(9x,'PT This terminal is immune to Prime Time.') call exit endif c c Finally, the cluster in which the user's terminal is located may not c currently be under PRIME TIME monitoring. c if(cluster_status.eq.0)then print 27 27 format(9x,'PT ', 1 'Prime Time monitoring is not active for this login.') call exit endif c c This user is being monitored, so calculate remaining time in minutes. c The total allowed connect time is the maximum of 4 possible values. c 32 return_code=sys$gettim(time_buff) call double(time_buff,current_time) max_slice=max(user_slice,terminal_slice,cluster_slice) if(max_slice.le.0)then time_slice=def_slice else time_slice=max_slice endif call double(login_time,login) time_diff=(current_time-login)/600000000.0d0 time_slice=time_slice+5-(time_diff-.5) if(time_slice.le.0)time_slice=1 print 35,time_slice 35 format(9x,'PT You have 'i3,' minutes until logout.') call exit 998 print 27 call exit end