 
Purpose
This macro will dump the TCB and socket meters for all sockets associated with a process or processes 
Display Form
| ----------------------------- get_process_sockets ---------------------------- match: -meters: yes -tcb: yes -process: 0 | 
Arguments
match STRING
This is the string that identifies the process. It can be a process name, a user name, anything that can be matched to the output of the analyze_system who request. If more than 1 process is matched, all processes are processed in process number order. This parameter is optional but if not provided a process number using the -process argument must be provided. You cannot provide a match string and a process number.
-meters YES/NO, default yes
If yes then the socket meters for any associated sockets is displayed.
-tcb YES/NO, default yes
If set to yes then the TCB for any associated sockets is displayed.
-process NUMBER
A process number. This parameter is optional but if not provided a match string must be provided. You cannot provide a process number and a match string.
Explanation
Basically the macro will call the following analyze_system requests
| start_process 'get_process_sockets sshd' -output_path gps_sshd.(date).(time).out + -privileged ready 15:21:55 ls gps* Files: 1, Blocks: 20 w 20 gps_sshd.09-11-27.15:21:55.out | 
| get_process_sockets sshd -no_meters -no_tcb OpenVOS Release 17.0.1bm, analyze_system Release 17.0.1bm Current process is 169, ptep 97E16A80, Noah_Davids.CAC as: as: as: ************************************************** as: ************************************************** as: Using nonrunning process. Current process is 70, ptep 97C4A2C0, root.root (sshd) as: as: as: as: as: ================================================== as: ================================================== as: PORTE number 6 Pathname: %phx_vos#stcp.m16_43 as: as: as: as: ================================================== as: ================================================== as: PORTE number 7 Pathname: %phx_vos#stcp.m16_44 as: as: as: as: ================================================== as: ================================================== as: PORTE number 8 Pathname: %phx_vos#stcp.m16_45 as: as: as: as: ================================================== as: ================================================== as: PORTE number 11 Pathname: %phx_vos#stcp.m16_46 as: as: as: as: ================================================== as: ================================================== as: PORTE number 12 Pathname: %phx_vos#stcp.m16_47 as: as: ************************************************** as: ************************************************** as: Using nonrunning process. Current process is 168, ptep 97E4D680, root.root (sshd) as: as: as: as: as: ================================================== as: ================================================== as: PORTE number 10 Pathname: %phx_vos#stcp.m16_65 as: ready 16:38:02 | 
| 
get_process_sockets -process 168                                                
OpenVOS Release 17.0.1bm, analyze_system Release 17.0.1bm
Current process is 169, ptep 97E16A80, Noah_Davids.CAC
as:
as:  **************************************************
as:  **************************************************
as:  Using nonrunning process.
Current process is 168, ptep 97E4D680, root.root (sshd)
as:  as:  as:  as:
as:  ==================================================
as:  ==================================================
as:  PORTE number 10 Pathname:            %phx_vos#stcp.m16_65
as:
stcp_meters   %phx_vos#m16                0:07:49       09-11-29 16:45:26
  STCP Version 4 loaded 09-11-25 17:03:26 TCB @97E45C40 09-11-29 16:37:37
  Metering time:      0:07:49
   segments received                            90 (avg 0.1918/sec)
     total bytes                              5303 (avg 11.30/sec)
       using fast mode                        5303 (100% of total bytes)
     flow controlled when received               0 (0% of segments rcvd)
     data pending when received                  0 (0% of segments rcvd)
     received out of order                       0 (0% of segments rcvd)
       seqno before expected                     0 (0% of out of order)
       seqno after expected                      0 (0% of out of order)
       segment outside window                    0 (0% of segments rcvd)
     fast path                                  90 (100% of segments rcvd)
       urgent data                               0 (0% of fast path)
     slow path                                   0 (0% of segments rcvd)
       urgent data                               0 (0% of slow path)
       overlap occurred                          0 (0% of slow path)
       backlap occurred                          0 (0% of slow path)
     window < max when received                  0 (0% of segments rcvd)
     window set zero after receive               0 (0% of segments rcvd)
     duplicate acks received                     1
   segments sent                               200 (avg 0.4264/sec)
     total bytes                             13198 (avg 28.14/sec)
       using fast mode                       13198 (100% of total bytes)
     retransmissions                             2 (1.0% of segments sent)
     probes sent                                 0 (avg 0/sec)
     keep_alives sent                            0 (avg 0/sec)
     explicit acks sent                          0 (avg 0/sec)
       due to > 1 segment unacked                0 (0% of explicit acks)
       due to window size increase               0 (0% of explicit acks)
       due to nonzero window size                0 (0% of explicit acks)
     timer acks sent                            32 (avg 0.0682/sec)
     duplicate acks sent                         0
   read service rtn executed                    92 (avg 0.1961/sec)
     data pending                                0 (0% of read srv calls)
       all pending beyond seqno                  0 (0% of data pending)
     queue empty                                 0 (0% of read srv calls)
     flow ctl before processing q                0 (0% of read srv calls)
     flow ctl after processing q                 0 (0% of read srv calls)
   bufdat executed                               0 (avg 0/sec)
     window set to max                           0 (0% of bufdat calls)
   allocation failures                           0
   recv seqn                              FD918932 (FD918902 last acked)
   recv window size                           8192 (8192 max)
   send seqn                              D3B754F1
   send window size                          15184 (16384 max)
   send bytes pending                         1424
as:  STCP_version 4
     tcbstructure at               97E45C40
*************** STCP TCB @ 97E45C40                                ************
     flink                         97E45940
     plink                         97E46540
     tcb_qptr                      97DD8A00
     tcb_state flag                TS_ESTAB
     state                         00000607
                                    ST_SR
                                    ST_SS
                                    ST_SA
                                    ST_RCV
                                    ST_SND
     dev                           79
     work                          00000208
                                    FL_ACK
                                    FL_RTT
     tickid                        0
     opt_flag                      37
     laddr                         A4984D80
     lport                         22
     fport                         8115
     faddr                         A4984D32
     ir_seq                        4254168186
     rcvseq                        4254173634
     rcvws                         8192
     maxrcvws                      8192
     finseq                        0
     rcvuseq                       0
     is_seq                        3551995634
     sndseq                        3552013009
     lweseq                        3552011809
     sndws                         15376
     maxsndws                      16384
     sndmax                        16384
     sndbr                         0
     sndcnt                        1200
     sndseg                        1460
     snduseq                       0
     snd_cwnd                      13217
     snd_ssthresh                  2920
     
     . . . . . . . . . . . . . . . . . .
      | 
| get_process_sockets noah_test -no_meters -no_tcb OpenVOS Release 17.0.1bm, analyze_system Release 17.0.1bm Current process is 169, ptep 97E16A80, Noah_Davids.CAC as: as: as: ************************************************** as: ************************************************** as: Using nonrunning process. Current process is 170, ptep 97C6E300, noah_test.CAC as: as: as: as: as: ================================================== as: ================================================== as: PORTE number 6 Pathname: %phx_vos#stcp.m16_66 as: ready 16:53:34 | 
| get_process_sockets osl_server OpenVOS Release 17.0.1bm, analyze_system Release 17.0.1bm Current process is 169, ptep 97E16A80, Noah_Davids.CAC as: as: as: ************************************************** as: ************************************************** as: Using nonrunning process. Current process is 56, ptep 97AE0000, Overseer.System (osl_server1) as: as: as: ************************************************** as: ************************************************** as: Using nonrunning process. Current process is 57, ptep 97AE1000, Overseer.System (osl_server2) as: as: as: ************************************************** as: ************************************************** as: Using nonrunning process. Current process is 58, ptep 97B46580, Overseer.System (osl_server3) as: as: ready 17:08:00 | 
| start_process 'get_process_sockets 55' -output_path gps_sshd.(date).(time).out - +privileged ready 17:11:00 ls gps* Files: 1, Blocks: 229 w 229 gps_sshd.09-11-29.17:01:23.out ready 17:11:43 | 
| 
& get_process_sockets.cm begins here                                            
&
& version 1.0 09-11-19
& version 1.1 10-11-26 Added disclaimer
& noah.davids@stratus.com
&
& This software is provided on an "AS IS" basis, WITHOUT ANY WARRANTY OR ANY
& SUPPORT OF ANY KIND. The AUTHOR SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES
& OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE.  This disclaimer
& applies, despite any verbal representations of any kind provided by the
& author or anyone else.
&
&begin_parameters
 NAME  match:string
 METERS switch (-meters),=1
 DUMP_TCB switch (-tcb),=1
 PROCNUM option (-process),number=0
&end_parameters
&
&if (process_type) = 'batch' &then &do
set_ready -format off
&echo no_command_lines no_macro_lines no_input_lines
&end
&
&attach_input
&
&set_string PROCS (process_dir)>procs
&set_string LPA (process_dir)>lpa
&set_string DP (process_dir)>dp
&set_string TCB (process_dir)>tcb
&
&if (length X&NAME&X) = 2 & &PROCNUM& = 0 &then &goto NO_ID
&if (length X&NAME&X) > 2 & &PROCNUM& > 0 &then &goto TOO_MANY_IDS
&
analyze_system
&if &PROCNUM& = 0
&then &do
..attach_default_output &PROCS&
match &NAME&; who
..detach_default_output
&end
&
&set LINE_PROCS 1
&label AGAIN_PROCS
&
&if &PROCNUM& = 0
&then &do
&set_string PROCESS &+
     (translate (contents &PROCS& &LINE_PROCS& -hold) _{} ' ()')
&if (length &PROCESS&) = 5 &then &goto DONE_PROCS
&if (length &PROCESS&) = 10 &then &goto NO_PROCS
&set_string PROCESS (translate &PROCESS& _ *)
&if &LINE_PROCS& = 1
&then &do
&set_string PROCESS (translate (substr &PROCESS& 6 6) (byte 32) _)
&end
&else &do
&set_string PROCESS (translate (substr &PROCESS& 1 6) (byte 32) _)
&end
&end
&else &do
&if &LINE_PROCS& > 1 &then &goto DONE_PROCS
&set PROCESS &PROCNUM&
&end
..display_line
..display_line **************************************************
..display_line **************************************************
process &PROCESS&
..attach_default_output &LPA&
match ' at ' -or '#stcp'; list_port_attachments
..detach_default_output
&
&set LINE_LPA 1
&set_string PORTE XXX
&label AGAIN_LPA
&set_string TEXT (translate (contents &LPA& &LINE_LPA& -hold) - (byte 32))
&if (end_of_file &LPA&) = 1 &then &goto DONE_LPA
&if (index &TEXT& '#stcp') > 0
&then &do
&set_string PORTE (substr &PORTE& (calc (index &PORTE& 'PORT-') + 5))
&set_string PORTE (substr &PORTE& 1 (calc (index &PORTE& '-at-') - 1))
..attach_default_output &DP&
dump_porte -number &PORTE&
..detach_default_output
..display &DP& -output_path &TCB& -no_header -match 'STCP TCB @ '
&set_string ATCB (substr (contents &TCB& 1) 28 8)
..display_line
..display_line ==================================================
..display_line ==================================================
..display_line PORTE number &PORTE& (translate &TEXT& (byte 32) - )
&if &METERS& &then stcp_meters &ATCB& -all -long
&if &DUMP_TCB& &then dump_onetcb &ATCB&
&end
&else &do
&set_string PORTE &TEXT&
&end
&        
&set LINE_LPA (calc &LINE_LPA& + 1)
&goto AGAIN_LPA
&
&label DONE_LPA
&set TEXT (contents &LPA& 1 -close)
&set LINE_PROCS (calc &LINE_PROCS& + 1)
&goto AGAIN_PROCS
&
&label NO_PROCS
..display_line
..display_line **************************************************
..display_line **************************************************
..display_line The name &NAME& matched no running processes
..display_line **************************************************
..display_line **************************************************
&
&label DONE_PROCS
&set TEXT (contents &PROCS& 1 -close)
quit
&return
&
&label NO_ID
display_line
display_line ****************************************************************
display_line ****************************************************************
display_line You must suppliy either a string to match on or a process number
display_line ****************************************************************
display_line ****************************************************************
&return
&
&label TOO_MANY_IDS
display_line
display_line ****************************************************************
display_line ****************************************************************  
display_line You must suppliy either a string to match on or a process number
display_line but not both          
display_line ****************************************************************
display_line ****************************************************************
&                 
& get_process_sockets.cm ends here
 | 
 
 Send comments and suggestions
Send comments and suggestions