Patch title: Release 90 bulk changes
Abstract:
File: /fullpliant/status.page
Key:
    Removed line
    Added line
   
module "/pliant/language/context.pli"
module "/pliant/language/stream.pli"
module "/pliant/language/os.pli"
module "/pliant/language/schedule/threads_engine.pli"
module "/pliant/language/schedule/resourcesem.pli"
module "/pliant/language/data/cache.pli"
module "/pliant/admin/file.pli"
module "/pliant/fullpliant/this_computer.pli"
module "/pliant/fullpliant/user.pli"
module "/pliant/fullpliant/shutdown.pli"
module "/pliant/language/os/process.pli"
module "/pliant/protocol/http/site.pli"
module "/pliant/protocol/common/tcp_server.pli"
module "/pliant/language/os/socket.pli"
module "/pliant/util/network/ping.pli"
module "/pliant/util/network/bench.pli"
module "/pliant/appli/database.pli"
module "/pliant/language/debug/compile_log.pli"
if os_api="linux"
  module "/pliant/linux/storage/filesystem.pli"
  module "/pliant/linux/kernel/statistics.pli"
  module "/pliant/protocol/time/client.pli"
  module "/pliant/linux/schedule/rtc.pli"
  module "/pliant/linux/storage/filesystem.pli"
  module "/pliant/linux/network/boot.pli"


  table columns 5
    cell void
    cell header [1 mn]
    cell header [1 hour]
    cell header [1 day]
    cell void
    cell header [CPU]
    for (var Int lap) 0 2
      cell
        if os_api="linux" and running_seconds>=(shunt lap=0 
          text string:(cast cpu_statistics:(shunt lap=0 60 l
          if lap=0
            (var Stream proc) open "file:/proc/loadavg" in+s
            if (proc:readline parse (var Float l1) (var Floa
              small
                text " ("+(string l1*100)+"%)"
        eif lap=0
          text "Not available under "+os_kernel
    cell
      if allowed:"administrator"
        note "details"
          memory_checkup
          title "CPU load report"
          header "Documentation"
            [In the status page, the number between brackets
            [See ] ; link "statistics.pli" "/pliant/linux/ke
          header "List of the running threads in this proces
            para
              text "Number of threads currently running in t
              text "Maximum number of running threads was: "
              if os_api="linux"
                text "Number of allocated stacks: "+string:t
            table columns 3
              cell header [Thread action stack]
              cell header [ID]
              cell header [Status]
              thread_list_sem request
              var Pointer:ThreadHeader h :> thread_list_pivo
              while addressof:h<>addressof:thread_list_pivot
                var Str state := ""
                if os_api="linux"
                  (var Stream status) open "file:/proc/"+(st
                  while not status:atend
                    status:readline parse "State" ":" any "(
                if state="running"
                  cell color (color hsl 60 50 75)
                    h:action_sem request
                    var Pointer:ActionRecord a :> h top_acti
                    while exists:a
                      text a:action ; eol
                      a :> a next
                    h:action_sem release
                eif state<>"sleeping"
                  cell color (color hsl 30 50 75)
                    h:action_sem request
                    var Pointer:ActionRecord a :> h top_acti
                    while exists:a
                      text a:action ; eol
                      a :> a next
                    h:action_sem release
                else
                  cell
                    h:action_sem request
                    var Pointer:ActionRecord a :> h top_acti
                    while exists:a
                      text a:action ; eol
                      a :> a next
                    h:action_sem release
                cell
                  if os_api="linux"
                    if false
                      var Int pid := h pid
                      note string:pid
                        button "Kill this thread"
                          thread
                            sleep 5
                            process_exit 1
                          os_kill pid os_SIGTERM       
                        [Be carrefull: if you press this but
                    else
                      text (string h:pid)
                cell
                  text state
                h :> h list_next
              thread_list_sem release
          if os_api="linux"
            header "List of all operating system threads"
              var Array:FileInfo files := file_list "file:/p
              para
                var Int count := 0
                for (var Int i) 0 files:size-1
                  if (files:i:name parse (var Int drop) "/")
                    count += 1
                text "Total number of threads running in the
              table columns 3
                cell header [Command]
                cell header [ID]
                cell header [Status]
                for (var Int i) 0 files:size-1
                  if (files:i:name parse (var Int pid) "/")
                    var Str name := "" ; var Str state := ""
                    (var Stream status) open "file:/proc/"+s
                    while not status:atend
                      var Str l := status readline
                      l parse "Name" ":" any:name
                      l parse "State" ":" any "(" any:state 
                    if state="running"
                      cell color (color hsl 60 20 75)
                        text name
                    eif state<>"sleeping"
                      cell color (color hsl 30 20 75)
                        text name
                    else
                      cell
                        text name
                    cell
                      text string:pid
                    cell
                      text state
 
    cell header [Memory]
    cell
      if os_api="linux"
        (var Stream proc) open "file:/proc/meminfo" in+safe
        var Int total := 0 ; var Int free := 0 ; var Int buf
        var Int swap_total := 0 ; var Int swap_free := 0
        while not proc:atend
          var Str l := proc readline
          l parse "MemTotal" ":" total any
          l parse "MemFree" ":" free any
          l parse "Buffers" ":" buffers any
          l parse "Cached" ":" cached any
        if os_api="linux" and  total<>0 and free<>0
          var Intn memory_total := total*2n^10
          var Int extra := max buffers+cached-16*2^10 0
          var Intn memory_free := (free+extra)*2n^10
          text (string 100n*(memory_total-memory_free)\memor
        eif memory_physical<>0
          text (string 100n*memory_current_consumed\memory_p
      eif os_api="win32"
        os_GlobalMemoryStatus (var os_MEMORYSTATUS ms)
        text (string ms:dwMemoryLoad)+"%"
      eif memory_physical<>0
        text (string 100n*memory_current_consumed\memory_phy
      else
        text "Not available under "+os_kernel
    cell void ; cell void
    cell
      if allowed:"administrator"
        note "details"
          memory_checkup
          title "Memory load report"
          header "This Pliant process"
            text "Memory currently used: "+(string memory_cu
            fixed [ ] ; small (text "("+string:memory_curren
            [Memory currently consumed: ] ; bold text:(strin
            fixed [ ] ; small (text "("+string:memory_curren
            text "Maximum consumed memory has been: "+(strin
            fixed [ ] ; small (text "("+string:memory_maximu
            text "Pliant has been configured to try to keep 
            fixed [ ] ; small (text "("+string:memory_assign
          header "Server global memory"
            if os_api="linux"
              (var Stream proc2) open "file:/proc/meminfo" i
              var Int total := 0 ; var Int free := 0 ; var I
              var Int swap_total := 0 ; var Int swap_free :=
              while not proc2:atend
                var Str l := proc2 readline
                l parse "MemTotal" ":" total any
                l parse "MemFree" ":" free any
                l parse "Buffers" ":" buffers any
                l parse "Cached" ":" cached any
                l parse "SwapTotal" ":" swap_total any
                l parse "SwapFree" ":" swap_free any
              if total<>0 and free<>0
                var Int extra := max buffers+cached-16*2^10 
                var Intn memory_total := total*2n^10
                var Intn memory_free := (free+extra)*2n^10
                var Intn memory_swap_total := swap_total*2n^
                var Intn memory_swap_free := swap_free*2n^10
                text "Total memory on this system: "+(string
                if memory_swap_total<>0
                  text " + "+(string memory_swap_total\2^20)
                eol
                text "Memory consumed by this Pliant process
                text "Memory consumed by other processes and
                if memory_swap_free<>0
                  text "Memory still available: "+(string me
                  text " + "+(string memory_swap_free\2^20)+
                  [ = ] ; bold text:(string (memory_free+mem
                else
                  [Memory still available: ] ; bold text:(st
                eol
              else
                [Not available with this Linux kernel]
            eif os_api="win32"
              os_GlobalMemoryStatus (var os_MEMORYSTATUS ms2
              text "Total memory on this system: "+(string m
              if ms2:dwTotalPageFile<>0
                text " + "+(string ms2:dwTotalPageFile\2^20)
              eol
              text "Memory consumed by this Pliant process: 
              if ms2:dwAvailPageFile<>0
                text "Memory still available: "+(string ms2:
                text " + "+(string ms2:dwAvailPageFile\2^20)
                [ = ] ; bold text:(string (ms2:dwAvailPhys+m
              else
                [Memory still available: ] ; bold text:(stri
            else
              text "Not available under "+os_kernel
          if os_api="linux" and allowed:"administrator"
            header "Linux kernel memory informations"
              cat "file:/proc/meminfo"
              cat "file:/proc/swaps"
    cell header [Disk]
module "/pliant/language/context.pli"
module "/pliant/language/stream.pli"
module "/pliant/language/os.pli"
module "/pliant/language/schedule/threads_engine.pli"
module "/pliant/language/schedule/resourcesem.pli"
module "/pliant/language/data/cache.pli"
module "/pliant/admin/file.pli"
module "/pliant/fullpliant/this_computer.pli"
module "/pliant/fullpliant/user.pli"
module "/pliant/fullpliant/shutdown.pli"
module "/pliant/language/os/process.pli"
module "/pliant/protocol/http/site.pli"
module "/pliant/protocol/common/tcp_server.pli"
module "/pliant/language/os/socket.pli"
module "/pliant/util/network/ping.pli"
module "/pliant/util/network/bench.pli"
module "/pliant/appli/database.pli"
module "/pliant/language/debug/compile_log.pli"
if os_api="linux"
  module "/pliant/linux/storage/filesystem.pli"
  module "/pliant/linux/kernel/statistics.pli"
  module "/pliant/protocol/time/client.pli"
  module "/pliant/linux/schedule/rtc.pli"
  module "/pliant/linux/storage/filesystem.pli"
  module "/pliant/linux/network/boot.pli"


  table columns 5
    cell void
    cell header [1 mn]
    cell header [1 hour]
    cell header [1 day]
    cell void
    cell header [CPU]
    for (var Int lap) 0 2
      cell
        if os_api="linux" and running_seconds>=(shunt lap=0 
          text string:(cast cpu_statistics:(shunt lap=0 60 l
          if lap=0
            (var Stream proc) open "file:/proc/loadavg" in+s
            if (proc:readline parse (var Float l1) (var Floa
              small
                text " ("+(string l1*100)+"%)"
        eif lap=0
          text "Not available under "+os_kernel
    cell
      if allowed:"administrator"
        note "details"
          memory_checkup
          title "CPU load report"
          header "Documentation"
            [In the status page, the number between brackets
            [See ] ; link "statistics.pli" "/pliant/linux/ke
          header "List of the running threads in this proces
            para
              text "Number of threads currently running in t
              text "Maximum number of running threads was: "
              if os_api="linux"
                text "Number of allocated stacks: "+string:t
            table columns 3
              cell header [Thread action stack]
              cell header [ID]
              cell header [Status]
              thread_list_sem request
              var Pointer:ThreadHeader h :> thread_list_pivo
              while addressof:h<>addressof:thread_list_pivot
                var Str state := ""
                if os_api="linux"
                  (var Stream status) open "file:/proc/"+(st
                  while not status:atend
                    status:readline parse "State" ":" any "(
                if state="running"
                  cell color (color hsl 60 50 75)
                    h:action_sem request
                    var Pointer:ActionRecord a :> h top_acti
                    while exists:a
                      text a:action ; eol
                      a :> a next
                    h:action_sem release
                eif state<>"sleeping"
                  cell color (color hsl 30 50 75)
                    h:action_sem request
                    var Pointer:ActionRecord a :> h top_acti
                    while exists:a
                      text a:action ; eol
                      a :> a next
                    h:action_sem release
                else
                  cell
                    h:action_sem request
                    var Pointer:ActionRecord a :> h top_acti
                    while exists:a
                      text a:action ; eol
                      a :> a next
                    h:action_sem release
                cell
                  if os_api="linux"
                    if false
                      var Int pid := h pid
                      note string:pid
                        button "Kill this thread"
                          thread
                            sleep 5
                            process_exit 1
                          os_kill pid os_SIGTERM       
                        [Be carrefull: if you press this but
                    else
                      text (string h:pid)
                cell
                  text state
                h :> h list_next
              thread_list_sem release
          if os_api="linux"
            header "List of all operating system threads"
              var Array:FileInfo files := file_list "file:/p
              para
                var Int count := 0
                for (var Int i) 0 files:size-1
                  if (files:i:name parse (var Int drop) "/")
                    count += 1
                text "Total number of threads running in the
              table columns 3
                cell header [Command]
                cell header [ID]
                cell header [Status]
                for (var Int i) 0 files:size-1
                  if (files:i:name parse (var Int pid) "/")
                    var Str name := "" ; var Str state := ""
                    (var Stream status) open "file:/proc/"+s
                    while not status:atend
                      var Str l := status readline
                      l parse "Name" ":" any:name
                      l parse "State" ":" any "(" any:state 
                    if state="running"
                      cell color (color hsl 60 20 75)
                        text name
                    eif state<>"sleeping"
                      cell color (color hsl 30 20 75)
                        text name
                    else
                      cell
                        text name
                    cell
                      text string:pid
                    cell
                      text state
 
    cell header [Memory]
    cell
      if os_api="linux"
        (var Stream proc) open "file:/proc/meminfo" in+safe
        var Int total := 0 ; var Int free := 0 ; var Int buf
        var Int swap_total := 0 ; var Int swap_free := 0
        while not proc:atend
          var Str l := proc readline
          l parse "MemTotal" ":" total any
          l parse "MemFree" ":" free any
          l parse "Buffers" ":" buffers any
          l parse "Cached" ":" cached any
        if os_api="linux" and  total<>0 and free<>0
          var Intn memory_total := total*2n^10
          var Int extra := max buffers+cached-16*2^10 0
          var Intn memory_free := (free+extra)*2n^10
          text (string 100n*(memory_total-memory_free)\memor
        eif memory_physical<>0
          text (string 100n*memory_current_consumed\memory_p
      eif os_api="win32"
        os_GlobalMemoryStatus (var os_MEMORYSTATUS ms)
        text (string ms:dwMemoryLoad)+"%"
      eif memory_physical<>0
        text (string 100n*memory_current_consumed\memory_phy
      else
        text "Not available under "+os_kernel
    cell void ; cell void
    cell
      if allowed:"administrator"
        note "details"
          memory_checkup
          title "Memory load report"
          header "This Pliant process"
            text "Memory currently used: "+(string memory_cu
            fixed [ ] ; small (text "("+string:memory_curren
            [Memory currently consumed: ] ; bold text:(strin
            fixed [ ] ; small (text "("+string:memory_curren
            text "Maximum consumed memory has been: "+(strin
            fixed [ ] ; small (text "("+string:memory_maximu
            text "Pliant has been configured to try to keep 
            fixed [ ] ; small (text "("+string:memory_assign
          header "Server global memory"
            if os_api="linux"
              (var Stream proc2) open "file:/proc/meminfo" i
              var Int total := 0 ; var Int free := 0 ; var I
              var Int swap_total := 0 ; var Int swap_free :=
              while not proc2:atend
                var Str l := proc2 readline
                l parse "MemTotal" ":" total any
                l parse "MemFree" ":" free any
                l parse "Buffers" ":" buffers any
                l parse "Cached" ":" cached any
                l parse "SwapTotal" ":" swap_total any
                l parse "SwapFree" ":" swap_free any
              if total<>0 and free<>0
                var Int extra := max buffers+cached-16*2^10 
                var Intn memory_total := total*2n^10
                var Intn memory_free := (free+extra)*2n^10
                var Intn memory_swap_total := swap_total*2n^
                var Intn memory_swap_free := swap_free*2n^10
                text "Total memory on this system: "+(string
                if memory_swap_total<>0
                  text " + "+(string memory_swap_total\2^20)
                eol
                text "Memory consumed by this Pliant process
                text "Memory consumed by other processes and
                if memory_swap_free<>0
                  text "Memory still available: "+(string me
                  text " + "+(string memory_swap_free\2^20)+
                  [ = ] ; bold text:(string (memory_free+mem
                else
                  [Memory still available: ] ; bold text:(st
                eol
              else
                [Not available with this Linux kernel]
            eif os_api="win32"
              os_GlobalMemoryStatus (var os_MEMORYSTATUS ms2
              text "Total memory on this system: "+(string m
              if ms2:dwTotalPageFile<>0
                text " + "+(string ms2:dwTotalPageFile\2^20)
              eol
              text "Memory consumed by this Pliant process: 
              if ms2:dwAvailPageFile<>0
                text "Memory still available: "+(string ms2:
                text " + "+(string ms2:dwAvailPageFile\2^20)
                [ = ] ; bold text:(string (ms2:dwAvailPhys+m
              else
                [Memory still available: ] ; bold text:(stri
            else
              text "Not available under "+os_kernel
          if os_api="linux" and allowed:"administrator"
            header "Linux kernel memory informations"
              cat "file:/proc/meminfo"
              cat "file:/proc/swaps"
    cell header [Disk]
    for (var Int lap) 0 2
      cell
        if os_api="linux"
          if lap=0
            var DiskInfo disk := filesystem_query "file:/"
            text (string 100n*(disk:size-disk:available)\disk:size)+"%"
            (var Stream proc) open "file:/proc/mdstat" in+safe
            var CBool raid := false ; var CBool ok := true
            while not proc:atend
              var Str l := proc readline
              if (reverse:l parse any "[rb]" any:(var Str disks) "[lb]" "[rb]" any "/" any "[lb]" any)
                raid := true
                if disks<>(repeat disks:len "U")
                  ok := false
            if raid
              fixed [  ]
              if ok
                small [RAID is ok]
              else
                highlight "RAID alarm"
            fixed [   ]
          if running_seconds>=(shunt lap=0 0 lap=1 3600\2 86400\2)
            disk_statistics "" (shunt lap=0 60 lap=1 3600 86400) (var Float read_bps) (var Float write_bps)
            text string:(cast read_bps/8/1024 Int)+" KB/s read + "+string:(cast write_bps/8/1024 Int)+" KB/s write"
        eif lap=0
          text "Not available under "+os_kernel
    cell
    cell
      if os_api="linux"
        var DiskInfo disk := filesystem_query "file:/"
        text (string 100n*(disk:size-disk:available)\disk:si
        (var Stream proc) open "file:/proc/mdstat" in+safe
        var CBool raid := false ; var CBool ok := true
        while not proc:atend
          var Str l := proc readline
          if (reverse:l parse any "[rb]" any:(var Str disks)
            raid := true
            if disks<>(repeat disks:len "U")
              ok := false
        if raid
          fixed [  ]
          if ok
            small [RAID is ok]
          else
            highlight "RAID alarm"
      else
        text "Not available under "+os_kernel
    cell void ; cell void
    cell
      if os_api="linux" and allowed:"administrator"
        note "details"
          title "Linux kernel storage informations"
      if os_api="linux" and allowed:"administrator"
        note "details"
          title "Linux kernel storage informations"
          header "Disk IO statistics"
            table columns 4
              cell header [Device]
              cell header [1 mn]
              cell header [1 hour]
              cell header [1 day]
              var List:Str devices := disk_devices
              var Pointer:Str dev1 :> devices first
              while exists:dev1
                cell
                  text dev1
                for (var Int lap) 0 2
                  cell
                    if running_seconds>=(shunt lap=0 0 lap=1 3600\2 86400\2)
                      disk_statistics dev1 (shunt lap=0 60 lap=1 3600 86400) (var Float read_bps) (var Float write_bps)
                      text string:(cast read_bps/8/1024 Int)+" KB/s read + "+string:(cast write_bps/8/1024 Int)+" KB/s write"
                dev1 :> devices next dev1
          cat "file:/proc/mounts"
          para
            var FileInfo root := file_query "file:/" extende
            (var Stream mnt) open "file:/proc/mounts" in+saf
            table columns 3
              cell header [Path]
              cell header [Load]
              cell header [Free/Total]
              while not mnt:atend
                if (mnt:readline parse any _ any:(var Str pa
                  var FileInfo pinfo := file_query "file:"+p
                  var Str pre := "file:"
                  if path<>"/" and (pinfo:options option "de
                    pre := "embedded:"
                  var DiskInfo info := filesystem_query pre+
                  if info:size>=0
                    cell
                      fixed (text pre+path)
                    cell
                      text string:(cast 100n*(info:size-info
                    cell
                      text string:(cast info:available\2^20 
          para
            var Str dev := "device:/hda1"
            input "Device: " dev length 12 noeol
            var Str path := "file:/mnt/target/"
            input "path: " path noeol
            input "options: " (var Str options) length 10 no
            button "Mount"
              filesystem_mount dev path options
              reload_page
            input "Device or path: " (var Str dev_or_path) n
            button "Dismount"
              filesystem_dismount dev_or_path
              reload_page
          cat "file:/proc/mdstat"
          cat "file:/proc/scsi/scsi"
          header "IDE devices"
            for (var Int i) 0 7
              var Str device := "hd"+(character "a":number+i
              (var Stream s) open "file:/proc/ide/"+device+"
              var Str model := s readline
              (var Stream s) open "file:/proc/ide/"+device+"
              var Str media := s readline
              if model<>""
                fixed (text device+"  "+media+"  "+model+"[l
          cat "file:/proc/partitions"
    cell header [Network]
    for (var Int lap) 0 2
      cell
        if os_api="linux" and running_seconds>=(shunt lap=0 
          net_statistics "" (shunt lap=0 60 lap=1 3600 86400
          text string:(cast in_bps/1024 Int)+" Kbps in + "+s
        eif lap=0
          text "Not available under "+os_kernel
    cell
      if os_api="linux" and allowed:"administrator"
        note "details"
          title "Linux kernel network informations"
          header "Bandwidth usage"
            table columns 4
              cell header [Device]
              cell header [1 mn]
              cell header [1 hour]
              cell header [1 day]
              var List:Str devices := net_devices
              var Pointer:Str dev :> devices first
              while exists:dev
                cell
                  text dev
                for (var Int lap) 0 2
                  cell
                    if running_seconds>=(shunt lap=0 0 lap=1
                      net_statistics dev (shunt lap=0 60 lap
                      text string:(cast in_bps/1024 Int)+" K
                dev :> devices next dev
          cat "file:/proc/net/dev"
          cat "file:/proc/net/route"
          cat "file:/dev/isdninfo"
          header "TCP connections"
            table columns 6
              cell header [Local IP]
              cell header [Local[lf]port]
              cell header [Remote IP]
              cell header [Remote[lf]port]
              cell header [Status]
              cell header [Timeout]
              for (var Int lap) 0 1
                (var Stream tcp) open "file:/proc/net/tcp" i
                while not tcp:atend
                  if (tcp:readline parse (var Int num) ":" a
                    if (shunt lap=0 st<>"06" st="06")
                      cell
                        text hexa_ip:lip
                      cell
                        text (string hexa_value:lport)
                      cell
                        text hexa_ip:rip
                      cell
                        text (string hexa_value:rport)
                      cell
                        text (shunt st="01" "established" st
                      cell
                        text to
          header "Check connection"
            button "Test TCP ports"
              title "TCP ports used"
              table columns 2
                cell header [TCP Port]
                cell header [Service]
                for (var Int i) 1 65535
                  (var Stream s) open "tcp://localhost/clien
                  if s=success
                    cell (text string:i)
                    cell
                      text (shunt i=21 "FTP" i=25 "SMTP" i=5
            input "Remote computer: " (var Str host) noeol
            var Int bench_seconds := 180
            input "Bench time in seconds: " bench_seconds le
            button "Can we access it ?" noeol
              if (dns_query_prototype host dns_query_functio
                table columns 1 border 0
                  cell color (color hsl 0 20 75)
                    text "Cannot find IP address of "+host
              eif net_ping:host=success
                table columns 1 border 0
                  cell color (color hsl 120 20 75)
                    text host+" can be accessed."
              else
                table columns 1 border 0
                  cell color (color hsl 0 20 75)
                    text host+" cannot be accessed."
            button "Test connection speed and reliability"
              net_bench host "seconds "+string:bench_seconds
              title "Network connection to "+host
              table columns 2
                cell [Upload speed]
                cell
                  if upload_kbps=undefined
                    [Could not connect to remote benchmark s
                  eif upload_kbps<10000
                    text string:(cast upload_kbps Int)+" Kbp
                  else
                    text string:(cast upload_kbps/1024 Int)+
                cell [Download speed]
                cell
                  if download_kbps=undefined
                    [Could not connect to remote benchmark s
                  eif download_kbps<10000
                    text string:(cast download_kbps Int)+" K
                  else
                    text string:(cast download_kbps/1024 Int
                cell [Reliability]
                cell
                  text string:(cast reliability*100 Int)+"%"
          header "Reconfigure"
            button "Reboot network layer"
              net_boot
              reload_page
    if os_api="linux" and allowed:"administrator"
          cat "file:/proc/mounts"
          para
            var FileInfo root := file_query "file:/" extende
            (var Stream mnt) open "file:/proc/mounts" in+saf
            table columns 3
              cell header [Path]
              cell header [Load]
              cell header [Free/Total]
              while not mnt:atend
                if (mnt:readline parse any _ any:(var Str pa
                  var FileInfo pinfo := file_query "file:"+p
                  var Str pre := "file:"
                  if path<>"/" and (pinfo:options option "de
                    pre := "embedded:"
                  var DiskInfo info := filesystem_query pre+
                  if info:size>=0
                    cell
                      fixed (text pre+path)
                    cell
                      text string:(cast 100n*(info:size-info
                    cell
                      text string:(cast info:available\2^20 
          para
            var Str dev := "device:/hda1"
            input "Device: " dev length 12 noeol
            var Str path := "file:/mnt/target/"
            input "path: " path noeol
            input "options: " (var Str options) length 10 no
            button "Mount"
              filesystem_mount dev path options
              reload_page
            input "Device or path: " (var Str dev_or_path) n
            button "Dismount"
              filesystem_dismount dev_or_path
              reload_page
          cat "file:/proc/mdstat"
          cat "file:/proc/scsi/scsi"
          header "IDE devices"
            for (var Int i) 0 7
              var Str device := "hd"+(character "a":number+i
              (var Stream s) open "file:/proc/ide/"+device+"
              var Str model := s readline
              (var Stream s) open "file:/proc/ide/"+device+"
              var Str media := s readline
              if model<>""
                fixed (text device+"  "+media+"  "+model+"[l
          cat "file:/proc/partitions"
    cell header [Network]
    for (var Int lap) 0 2
      cell
        if os_api="linux" and running_seconds>=(shunt lap=0 
          net_statistics "" (shunt lap=0 60 lap=1 3600 86400
          text string:(cast in_bps/1024 Int)+" Kbps in + "+s
        eif lap=0
          text "Not available under "+os_kernel
    cell
      if os_api="linux" and allowed:"administrator"
        note "details"
          title "Linux kernel network informations"
          header "Bandwidth usage"
            table columns 4
              cell header [Device]
              cell header [1 mn]
              cell header [1 hour]
              cell header [1 day]
              var List:Str devices := net_devices
              var Pointer:Str dev :> devices first
              while exists:dev
                cell
                  text dev
                for (var Int lap) 0 2
                  cell
                    if running_seconds>=(shunt lap=0 0 lap=1
                      net_statistics dev (shunt lap=0 60 lap
                      text string:(cast in_bps/1024 Int)+" K
                dev :> devices next dev
          cat "file:/proc/net/dev"
          cat "file:/proc/net/route"
          cat "file:/dev/isdninfo"
          header "TCP connections"
            table columns 6
              cell header [Local IP]
              cell header [Local[lf]port]
              cell header [Remote IP]
              cell header [Remote[lf]port]
              cell header [Status]
              cell header [Timeout]
              for (var Int lap) 0 1
                (var Stream tcp) open "file:/proc/net/tcp" i
                while not tcp:atend
                  if (tcp:readline parse (var Int num) ":" a
                    if (shunt lap=0 st<>"06" st="06")
                      cell
                        text hexa_ip:lip
                      cell
                        text (string hexa_value:lport)
                      cell
                        text hexa_ip:rip
                      cell
                        text (string hexa_value:rport)
                      cell
                        text (shunt st="01" "established" st
                      cell
                        text to
          header "Check connection"
            button "Test TCP ports"
              title "TCP ports used"
              table columns 2
                cell header [TCP Port]
                cell header [Service]
                for (var Int i) 1 65535
                  (var Stream s) open "tcp://localhost/clien
                  if s=success
                    cell (text string:i)
                    cell
                      text (shunt i=21 "FTP" i=25 "SMTP" i=5
            input "Remote computer: " (var Str host) noeol
            var Int bench_seconds := 180
            input "Bench time in seconds: " bench_seconds le
            button "Can we access it ?" noeol
              if (dns_query_prototype host dns_query_functio
                table columns 1 border 0
                  cell color (color hsl 0 20 75)
                    text "Cannot find IP address of "+host
              eif net_ping:host=success
                table columns 1 border 0
                  cell color (color hsl 120 20 75)
                    text host+" can be accessed."
              else
                table columns 1 border 0
                  cell color (color hsl 0 20 75)
                    text host+" cannot be accessed."
            button "Test connection speed and reliability"
              net_bench host "seconds "+string:bench_seconds
              title "Network connection to "+host
              table columns 2
                cell [Upload speed]
                cell
                  if upload_kbps=undefined
                    [Could not connect to remote benchmark s
                  eif upload_kbps<10000
                    text string:(cast upload_kbps Int)+" Kbp
                  else
                    text string:(cast upload_kbps/1024 Int)+
                cell [Download speed]
                cell
                  if download_kbps=undefined
                    [Could not connect to remote benchmark s
                  eif download_kbps<10000
                    text string:(cast download_kbps Int)+" K
                  else
                    text string:(cast download_kbps/1024 Int
                cell [Reliability]
                cell
                  text string:(cast reliability*100 Int)+"%"
          header "Reconfigure"
            button "Reboot network layer"
              net_boot
              reload_page
    if os_api="linux" and allowed:"administrator"
      cell header [Hardware] ; cell void ; cell void ; cell 
      cell header [Hardware]
      for (var Int lap) 0 2
        cell
          if running_seconds>=(shunt lap=0 0 lap=1 3600\2 86400\2)
            var Float ips := interrupts_statistics (shunt lap=0 60 lap=1 3600 86400)
            text (string ips "fixed 0")+" interrupts/s"
      cell
        note "details"
          title "Linux kernel hardware informations"
          cat "file:/proc/cpuinfo"
          header "PCI devices"
            table columns 5
              cell header [c. ID]
              cell header [constructor]
              cell header [p. ID]
              cell header [rev]
              cell header [product label]
              if (file_query "data:/pliant/fullpliant/pci_de
                module "/pliant/protocol/http/client.pli"
                file_copy "http://www.yourvote.com/pci/vendo
              if (file_query "data:/pliant/fullpliant/pci_de
                module "/pliant/protocol/http/client.pli"
                file_copy "http://members.hyperlink.net.au/~
              (var Stream s) open "file:/proc/pci" in+safe
              while not s:atend
                if (s:readline parse any word:"device" any:(
                  var Str v_name := "" ; var Str d_name := "
                  (var Stream lst) open "data:/pliant/fullpl
                  while not lst:atend
                    var Str l := lst readline
                    if (l 4 1)="[tab]"
                      v_ok := upper:(l 0 4)=upper:vendor
                      if v_ok
                        v_name := l 5 l:len
                    eif (l 0 1)="[tab]" and upper:(l 1 4)=up
                      d_name := l 6 l:len
                  v_ok := false ; d_ok := false
                  (var Stream lst) open "data:/pliant/fullpl
                  while not lst:atend
                    var Str l := lst readline
                    if (l parse any:(var Str code) _ any:(va
                      if code="V"
                        v_ok := upper:id=upper:vendor ; d_ok
                        if v_ok
                          v_name := name
                      eif code="D"
                        d_ok := v_ok and upper:id=upper:devi
                        if d_ok
                          d_name := l 7 l:len
                      eif code="R"
                        if d_ok and upper:(right id 4 "0")=u
                          d_name := name
                  cell
                    text upper:vendor
                  cell
                    text v_name
                  cell
                    text upper:device
                  cell
                    text upper:rev
                  cell
                    text d_name
          cat "file:/proc/pci"
          cat "file:/proc/ioports"
          cat "file:/proc/interrupts"
          cat "file:/proc/rtc"
      cell header [OS kernel] ; cell void ; cell void ; cell
      cell
        note "details"
          title "Linux kernel informations"
          cat "file:/proc/sys/kernel/osrelease"
          cat "file:/proc/modules"
          cat "file:/proc/kmsg"


      cell
        note "details"
          title "Linux kernel hardware informations"
          cat "file:/proc/cpuinfo"
          header "PCI devices"
            table columns 5
              cell header [c. ID]
              cell header [constructor]
              cell header [p. ID]
              cell header [rev]
              cell header [product label]
              if (file_query "data:/pliant/fullpliant/pci_de
                module "/pliant/protocol/http/client.pli"
                file_copy "http://www.yourvote.com/pci/vendo
              if (file_query "data:/pliant/fullpliant/pci_de
                module "/pliant/protocol/http/client.pli"
                file_copy "http://members.hyperlink.net.au/~
              (var Stream s) open "file:/proc/pci" in+safe
              while not s:atend
                if (s:readline parse any word:"device" any:(
                  var Str v_name := "" ; var Str d_name := "
                  (var Stream lst) open "data:/pliant/fullpl
                  while not lst:atend
                    var Str l := lst readline
                    if (l 4 1)="[tab]"
                      v_ok := upper:(l 0 4)=upper:vendor
                      if v_ok
                        v_name := l 5 l:len
                    eif (l 0 1)="[tab]" and upper:(l 1 4)=up
                      d_name := l 6 l:len
                  v_ok := false ; d_ok := false
                  (var Stream lst) open "data:/pliant/fullpl
                  while not lst:atend
                    var Str l := lst readline
                    if (l parse any:(var Str code) _ any:(va
                      if code="V"
                        v_ok := upper:id=upper:vendor ; d_ok
                        if v_ok
                          v_name := name
                      eif code="D"
                        d_ok := v_ok and upper:id=upper:devi
                        if d_ok
                          d_name := l 7 l:len
                      eif code="R"
                        if d_ok and upper:(right id 4 "0")=u
                          d_name := name
                  cell
                    text upper:vendor
                  cell
                    text v_name
                  cell
                    text upper:device
                  cell
                    text upper:rev
                  cell
                    text d_name
          cat "file:/proc/pci"
          cat "file:/proc/ioports"
          cat "file:/proc/interrupts"
          cat "file:/proc/rtc"
      cell header [OS kernel] ; cell void ; cell void ; cell
      cell
        note "details"
          title "Linux kernel informations"
          cat "file:/proc/sys/kernel/osrelease"
          cat "file:/proc/modules"
          cat "file:/proc/kmsg"