3 # Display files and network connections that a process has open
5 require './proc-lib.pl';
7 &ui_print_header(undef, $text{'open_title'}, "", "open_proc");
8 %pinfo = &process_info($in{'pid'});
9 &can_edit_process($pinfo{'user'}) || &error($text{'edit_ecannot'});
11 print "<b>$text{'edit_gone'}</b> <p>\n";
12 &ui_print_footer("", $text{'index_return'});
16 print "<b>",&text('open_proc', "<tt>$pinfo{'args'}</tt>", $in{'pid'}),
20 print &ui_subheading($text{'open_header1'});
21 @files = &find_process_files($in{'pid'});
22 print &ui_columns_start([ $text{'open_fd'},
26 $text{'open_file'} ], 100, 0);
28 print &ui_columns_row([
29 $f->{'fd'} eq 'cwd' ? $text{'open_cwd'} :
30 $f->{'fd'} eq 'rtd' ? $text{'open_rtd'} :
31 $f->{'fd'} eq 'txt' ? $text{'open_txt'} :
32 $f->{'fd'} eq 'mem' ? $text{'open_mem'} :
34 $f->{'type'} =~ /^v?dir$/ ? $text{'open_dir'} :
35 $f->{'type'} =~ /^v?reg$/ ? $text{'open_reg'} :
36 $f->{'type'} =~ /^v?chr$/ ? $text{'open_chr'} :
37 $f->{'type'} =~ /^v?blk$/ ? $text{'open_blk'} :
44 print &ui_columns_end();
46 # Show network connections
47 @nets = &find_process_sockets($in{'pid'});
49 print &ui_subheading($text{'open_header2'});
51 print &ui_columns_start([ $text{'open_type'},
54 $text{'open_desc'} ], 100, 0,
55 [ "", "", "", "colspan=4" ]);
57 @cols = ( uc($n->{'type'}),
60 @tds = ( "", "", "" );
61 if ($n->{'listen'} && $n->{'lhost'} eq '*') {
62 push(@cols, &text('open_listen1',
63 "<tt>$n->{'lport'}</tt>"));
64 push(@tds, "colspan=4");
66 elsif ($n->{'listen'}) {
67 push(@cols, &text('open_listen2',
68 "<tt>$n->{'lhost'}</tt>",
69 "<tt>$n->{'lport'}</tt>"));
70 push(@tds, "colspan=4");
72 elsif ($n->{'rhost'}) {
73 push(@cols, "<tt>$n->{'lhost'}:$n->{'lport'}</tt>",
75 "<tt>$n->{'rhost'}:$n->{'rport'}</tt>",
76 "<tt>$n->{'state'}</tt>");
79 push(@cols, &text('open_recv', "<tt>$n->{'lhost'}</tt>",
80 "<tt>$n->{'lport'}</tt>"));
81 push(@tds, "colspan=4");
83 print &ui_columns_row(\@cols, \@tds);
85 print &ui_columns_end();
88 &ui_print_footer("edit_proc.cgi?$in{'pid'}", $text{'edit_return'},
89 "", $text{'index_return'});