On Tue, Nov 21, 2000 at 01:21:38PM +0000, Peter Pilgrim wrote:
> 
> Yep that's one way.
> 
> How do you find out what process details (uid, gid, terminal id, command line, 
>environment variables)
> are apart from just `ls /proc'

There's lots of info in the /proc man page. For example, each process'
command line can be found in /proc/<pid>/cmdline, where <pid> is the
process ID, and reading the file returns a null-separated list of
arguments.  Environments can be found, in a similar format, in
/proc/<pid>/environ. Basically, your program needs to step through all
directories with numeric names under /proc and pull the interesting
information out of those directories.

Some of the information is tricky to extract from Java, and you
probably will need native calls to fully resolve it. For example,
you can get UID and GID by looking at the owner and group of the
/proc/<pid> directory - but Java's not much help at retrieving such
information. You can identify the process' files by looking at
the symlinks in /proc/<pid>/fd, but Java's no help at identifying
symlinks.

One final barrier: some of the stuff in /proc is only readable by
the process owners or the superuser. But you'd have the same barrier
with system calls.


> 
> I should have said a UNIX system api call like the "mntent()" call that
> exists that allows you to read UNIX mount table environment.

/proc/mounts


Nathan

> 
> Is there such thing as `psent()' call?
> 
> --
> Peter Pilgrim
> G.O.A.T
>                     "The Greatest of All Time"
> 
> 
> 
> ---------------------------------------- Message History 
>----------------------------------------
> 
> 
> From: Lopez Jose Ariel <[EMAIL PROTECTED]> on 21/11/2000 10:09 NST
> 
> To:   Peter Pilgrim/DMGIT/DMG UK/DeuBa@DMG UK
> cc:   [EMAIL PROTECTED]
> Subject:  Re: How do you get to process list ?(ps auwwx in Java)
> 
> 
> Peter:
>      You can read /proc filesystem for that
> Try info /proc for more information
> Ariel Lopez
> 
> On Tue, 21 Nov 2000, Peter Pilgrim wrote:
> 
> >
> >
> > Hi
> >
> > I am considering writing a JNI to the process list.
> > How do you do this in Linux/Unix?
> >
> > --
> > Peter Pilgrim
> > G.O.A.T
> >                     "The Greatest of All Time"
> >
> >
> >
> > --
> >
> > This e-mail may contain confidential and/or privileged information. If you are not 
>the intended recipient (or have received this e-mail in error) please notify the 
>sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or 
>distribution of the material in this e-mail is strictly forbidden.
> >
> >
> > ----------------------------------------------------------------------
> > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> >
> >
> 
> 
> 
> 
> 
> 
> --
> 
> This e-mail may contain confidential and/or privileged information. If you are not 
>the intended recipient (or have received this e-mail in error) please notify the 
>sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or 
>distribution of the material in this e-mail is strictly forbidden.
> 
> 
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to