Roxen.git / server / config_actions / proc.pike

version» Context lines:

Roxen.git/server/config_actions/proc.pike:1:   /* -  * $Id: proc.pike,v 1.4 1997/09/06 16:26:34 grubba Exp $ +  * $Id: proc.pike,v 1.5 1997/09/06 17:10:26 noring Exp $    */      inherit "wizard";      constant name= "Status//Extended process status";   constant doc = "Shows detailed process status on Solaris 2.5 and 2.6.";      constant more=1;      void create()
Roxen.git/server/config_actions/proc.pike:74:    if(search(in,"/proc/")==-1)    return (pre+    "<a href=/Actions/?action=proc.pike&pid="+pid+"&unique="+time()+">"+    (ipid==pid?"<b>":"")+    html_encode_string(in)+    (ipid==pid?"</b>":"")+    "</a>\n");    return "";   }    + string cred(object id) + { +  string r = "", s; +  int uid, gid; +  if(sscanf(proc("cred",id->variables->pid), "%*d:\te/r/suid=%d " +  "e/r/sgid=%d\n\tgroups:%s\n", uid, gid, s) != 4) +  return "-<br>"; +  array groups = ((s||"")/" ") - ({ "" }); +  for(int i = 0; i < sizeof(groups); i++) +  groups[i] = getgrgid((int)groups[i])[0]; +  return sprintf("e/r/suid: %s<br>e/r/sgid: %s<br>groups: %O\n", +  getpwuid(uid)[0], getgrgid(gid)[0], +  String.implode_nicely(groups)); + }      mixed page_0(object id, object mc)   {    string map = proc("map -x",(int)id->variables->pid);    if(sscanf(map, "%*sShared%*s") != 2)    map = process_map(proc("map",(int)id->variables->pid));    else    map = process_map2(map);       string tree = Array.map(proc("tree -a",(int)id->variables->pid)/"\n",format_proc_line,    (int)id->variables->pid||getpid())*"";       return ("<font size=+1>Process Tree for "+(id->variables->pid||getpid())+"</font><pre>\n"+    tree+    "</pre><font size=+1>Misc status for "+(id->variables->pid||getpid()) -  +"</font><pre>Memory Usage: "+map+"\n\nCredentials: "+ -  ((proc("cred",id->variables->pid)/":")[1..]*":")+ -  "\nCwd: "+ +  +"</font><pre>Memory Usage: "+map+"\n\nCredentials:<br>"+cred(id)+ +  "\nCurrent working directory: "+    ((proc("wdx",id->variables->pid)/":")[1..]*":")+   // "Stack: "+(proc("stack",id->variables->pid)/":")[1..]*":"+    "</pre>");   }      mixed handle(object id) { return wizard_for(id,0); }