Thanks!

> Date: Wed, 17 Jun 2015 10:47:54 -0400
> From: [email protected]
> To: [email protected]
> Subject: Re: [Jprogramming] Linux, J and reading /proc
> 
> I am going to guess it won't read because the file size is reported as 0
> 
>    (1!:0) <'/proc/net/sockstat'
> ┌────────┬──────────────────┬─┬───┬──────┬──────────┐
> │sockstat│2015 6 17 14 46 17│0│r--│r-----│-r--r--r--│
> └────────┴──────────────────┴─┴───┴──────┴──────────┘
> 
> You can execute host commands through 2!:0 on linux (no jtask needed)
> 
>    [ t=:(2!:0) 'cat /proc/net/sockstat'
> sockets: used 96
> TCP: inuse 9 orphan 0 tw 0 alloc 12 mem 2
> UDP: inuse 0 mem 0
> UDPLITE: inuse 0
> RAW: inuse 0
> FRAG: inuse 0 memory 0
> 
> On Wed, Jun 17, 2015 at 10:10 AM, Jon Hough <[email protected]> wrote:
> 
> > In J, is there a way to read /proc files in Linux (for example to get
> > network stats, or process info etc)?(/proc info:
> > http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html )
> >
> > For example, in Python, if I wanted to read sockstat, I might do:
> >
> > def get_info(path):             f = open(path,'r')              return
> > f.readlines()
> >
> >
> > if __name__ == '__main__':
> >         map(lambda x: print(x), get_info('/proc/net/sockstat'))
> >
> > In J, to get the same functionality I am using
> >
> > ]data =. spawn_jtask_ 'cat /proc/net/sockstat'
> >
> >
> > Is there a way to get this information without using Jtask?
> > 1!:1 does not work, but is there another verb to do this?
> >
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
                                          
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to