Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 336ea780dd5b6ba938e2f5871665c96812d850ba
Ticket: 873294ffffffffffffffffffffffffffffffffff
script crashes Tcl 8.4.X on Solaris (verified by J. Hobbs)
User & Date: nobody on 2004-01-08 20:25:24
Changes

  1. assignee changed to: "hobbs"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    # this script crashes under Tcl 8.4.X (all versions)
    # 32 bit compile under gcc 3.3.1
    # on:
    # SunOS ldas-suntest2 5.9 Generic_112233-07 sun4u sparc
    SUNW,Sun-Fire-280R Solaris
    # and possibly others... but does not crash under Tcl
    <= 8.3.5
    
    proc solaris { file } {
        
         if { [ catch {
            
            set now [ clock seconds ]
            set usr [ file attributes $file -owner ]
            
            set fid [ open $file r ]
            
            fconfigure $fid -encoding binary -translation
    binary
            
            set numinfo [ read $fid 88 ]
            set fname   [ read $fid 16 ]
            set args    [ read $fid 80 ]
            set more    [ read $fid 16 ]
            ::close $fid
            
            ;## the meaty part
            binary scan $numinfo IIIIIIIIIIIIIIISSI \
               . . pid ppid . . ruser . . . . vsz rsz . .
    pcpu pmem stt
            
            ;## try to make sense out of pr_wstat
            binary scan $more I state
            if { $state == 0 } {
               set state R
            } else {
               set state Z
            }
            
            regsub -all \x00 $fname {} fname
            regsub -all \x00 $args  {} args
            
            set etime [ expr { $now - $stt } ]
            
            if { ! [ string equal 0 $pmem ] } {
               set pmem [ expr { $pmem / 327.67 } ]
               set pmem [ format %.2f $pmem ]
            }
            
            if { ! [ string equal 0 $pcpu ] } {
               set pcpu [ expr { $pcpu / 327.67 } ]
               set pcpu [ format %.2f $pcpu ]
            }
         } err ] } {
            return -code error $err
         }
         puts stderr "$pid $state $usr $vsz $rsz $pcpu
    $pmem $etime $fname $args"
    }
    
    foreach file [ glob /proc/*/psinfo ] {
            puts stderr $file
            solaris $file
    }
    
    
  4. foundin changed to: "obsolete: 8.4.5"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "41. Memory Allocation"
  10. title changed to:
    script crashes Tcl 8.4.X on Solaris (verified by J. Hobbs)
    
  11. type changed to: "Bug"