Re: getting a list of open files versus PID nos.?

2010-12-08 Thread Garrett Cooper
On Wed, Dec 8, 2010 at 3:52 PM, Garrett Cooper  wrote:
> On Wed, Dec 8, 2010 at 3:47 PM, Matthew Fleming  wrote:
>> On Wed, Dec 8, 2010 at 3:01 PM, Bruce Cran  wrote:
>>> On Wed, 8 Dec 2010 14:54:57 -0800
>>> Matthew Fleming  wrote:
>>>
 This is what lsof is for.  I believe there's one in ports, but I have
 never tried it.
>>>
>>> Is there any advantage to using lsof instead of fstat(1) (fstat -p pid)?
>>
>> I believe that lsof reports on all open files by all processes,
>> whereas fstat will only report on a specific provided pid.
>
>    lsof prints out all open file descriptors whereas I thought that
> fstat had to be targeted to specific files / directories / vmcore
> files / etc.

Nevermind. As Andriy pointed out in a later post, I was wrong.
Thanks,
-Garrett
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: getting a list of open files versus PID nos.?

2010-12-08 Thread Andriy Gapon
on 09/12/2010 01:47 Matthew Fleming said the following:
> On Wed, Dec 8, 2010 at 3:01 PM, Bruce Cran  wrote:
>> On Wed, 8 Dec 2010 14:54:57 -0800
>> Matthew Fleming  wrote:
>>
>>> This is what lsof is for.  I believe there's one in ports, but I have
>>> never tried it.
>>
>> Is there any advantage to using lsof instead of fstat(1) (fstat -p pid)?
> 
> I believe that lsof reports on all open files by all processes,
> whereas fstat will only report on a specific provided pid.

Just try running fstat without any options.
Or procstat -a -f.

-- 
Andriy Gapon
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: getting a list of open files versus PID nos.?

2010-12-08 Thread richo

On 08/12/10 17:18 -0500, Chuck Robey wrote:
What I want to see is a list of all Pids and how many open files 
there are associated with each Pid?  And maybe a "ps ax" list, so I 
can associate an application with a pid.  I would set things up so it 
would do this every 15 minutes, and it might just point me at my real 
Any idea what would be the best way to get a list of all openfiles 
versus each open pid?  I would be happy to write up a python script 
to give me application versus count of open files list, if I could 
start with that files versus pids thing.


lsof is what you're looking for.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: getting a list of open files versus PID nos.?

2010-12-08 Thread Garrett Cooper
On Wed, Dec 8, 2010 at 3:47 PM, Matthew Fleming  wrote:
> On Wed, Dec 8, 2010 at 3:01 PM, Bruce Cran  wrote:
>> On Wed, 8 Dec 2010 14:54:57 -0800
>> Matthew Fleming  wrote:
>>
>>> This is what lsof is for.  I believe there's one in ports, but I have
>>> never tried it.
>>
>> Is there any advantage to using lsof instead of fstat(1) (fstat -p pid)?
>
> I believe that lsof reports on all open files by all processes,
> whereas fstat will only report on a specific provided pid.

lsof prints out all open file descriptors whereas I thought that
fstat had to be targeted to specific files / directories / vmcore
files / etc.
Thanks,
-Garrett
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: getting a list of open files versus PID nos.?

2010-12-08 Thread Matthew Fleming
On Wed, Dec 8, 2010 at 3:01 PM, Bruce Cran  wrote:
> On Wed, 8 Dec 2010 14:54:57 -0800
> Matthew Fleming  wrote:
>
>> This is what lsof is for.  I believe there's one in ports, but I have
>> never tried it.
>
> Is there any advantage to using lsof instead of fstat(1) (fstat -p pid)?

I believe that lsof reports on all open files by all processes,
whereas fstat will only report on a specific provided pid.

Thanks,
matthew
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: getting a list of open files versus PID nos.?

2010-12-08 Thread Anonymous
Bruce Cran  writes:

> On Wed, 8 Dec 2010 14:54:57 -0800
> Matthew Fleming  wrote:
>
>> This is what lsof is for.  I believe there's one in ports, but I have
>> never tried it.
>
> Is there any advantage to using lsof instead of fstat(1) (fstat -p pid)?

procstat(1) can display actual files instead of inodes, e.g.

  $ procstat -f $(pgrep qemu)
PID COMM   FD T V FLAGSREF  OFFSET PRO NAME
  14300 qemu-system-x86_64  cwd v d    -   - -   /home/holo
  14300 qemu-system-x86_64 root v d    -   - -   /
  14300 qemu-system-x86_640 v c rw--   6 3247126 -   /dev/pts/4
  14300 qemu-system-x86_641 v c rw--   6 3247126 -   /dev/pts/4
  14300 qemu-system-x86_642 v c rw--   6 3247126 -   /dev/pts/4
  14300 qemu-system-x86_643 p - rw---n--   1   0 -   -
  14300 qemu-system-x86_644 p - rw---n--   1   0 -   -
  14300 qemu-system-x86_645 v r rw--f---   1 4294967296 -   /b/blah.img
  14300 qemu-system-x86_646 p - rw---n--   1   0 -   -
  14300 qemu-system-x86_647 p - rw---n--   1   0 -   -
  14300 qemu-system-x86_648 v r r---f---   1 283918336 -   
/b/netbsd-amd64cd-201012060900Z.iso
  14300 qemu-system-x86_649 s - rw---n--   1   0 TCP ::. ::.0
  14300 qemu-system-x86_64   10 s - rw---n--   1   0 TCP 
:::127.0.0.1. :::127.0.0.1.26806
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: getting a list of open files versus PID nos.?

2010-12-08 Thread Bruce Cran
On Wed, 8 Dec 2010 14:54:57 -0800
Matthew Fleming  wrote:

> This is what lsof is for.  I believe there's one in ports, but I have
> never tried it.

Is there any advantage to using lsof instead of fstat(1) (fstat -p pid)?

-- 
Bruce Cran
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: getting a list of open files versus PID nos.?

2010-12-08 Thread Matthew Fleming
On Wed, Dec 8, 2010 at 2:18 PM, Chuck Robey  wrote:
> I think, *maybe* that I have located what's been giving me all of those
> machine lockups.  I was all ready to replace the mobo & cpu when I noticed a
> panic error of being out of open files.  The message suggested just adding
> the ability for more open files, but if it's what I think it is, that would
> only mean it would take longer to panic, but it would still be tossing
> panics at me.
>
> What I want to see is a list of all Pids and how many open files there are
> associated with each Pid?  And maybe a "ps ax" list, so I can associate an
> application with a pid.  I would set things up so it would do this every 15
> minutes, and it might just point me at my real problem here.
>
> Any idea what would be the best way to get a list of all openfiles versus
> each open pid?  I would be happy to write up a python script to give me
> application versus count of open files list, if I could start with that
> files versus pids thing.

This is what lsof is for.  I believe there's one in ports, but I have
never tried it.

Cheers,
matthew
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


getting a list of open files versus PID nos.?

2010-12-08 Thread Chuck Robey
I think, *maybe* that I have located what's been giving me all of those machine 
lockups.  I was all ready to replace the mobo & cpu when I noticed a panic error 
of being out of open files.  The message suggested just adding the ability for 
more open files, but if it's what I think it is, that would only mean it would 
take longer to panic, but it would still be tossing panics at me.


What I want to see is a list of all Pids and how many open files there are 
associated with each Pid?  And maybe a "ps ax" list, so I can associate an 
application with a pid.  I would set things up so it would do this every 15 
minutes, and it might just point me at my real problem here.


Any idea what would be the best way to get a list of all openfiles versus each 
open pid?  I would be happy to write up a python script to give me application 
versus count of open files list, if I could start with that files versus pids thing.

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: coretemp(4)/amdtemp(4) and sysctl nodes

2010-12-08 Thread Dag-Erling Smørgrav
Mark Johnston  writes:
> Aren't the dev.cpu.X and the coretemp sysctls matched up by the use of
>
> SYSCTL_CHILDREN(device_get_sysctl_tree(pdev))
>
> in coretemp's sysctl definition? What does the sysctl context have to do
> with identifying the parent oid?

They're intended to go hand in hand.  I would have preferred that
contexts were actually tied to subtrees, but I had to play the ball I
was given.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"