Re: Problem in reading struct file.
Re: Problem in reading struct file.
- Subject: Re: Problem in reading struct file.
- From: Terry Lambert <email@hidden>
- Date: Thu, 15 May 2008 01:10:54 -0700
The top source code includes source for the library libtop.
In Mac OS X that isn't so old we didn't even have Intel machines when
it was born (i.e. later than 10.3, which is very old), there are SPI
in libSystem that don't have headers except as published as Darwin
source code.
Also note that in later versions of Mac OS X, there is no libkvm, and /
dev/mem and /dev/kmem do not exist by default anyway.
You are really plumbing the depths of ancient history here, are you
absolutely certain your performance requires you to do this yourself?
-- Terry
On May 14, 2008, at 10:54 PM, Manish Chaturvedi <email@hidden
> wrote:
Hi Terry,
Thanks for your valuable reply!
I am more incline to have my own lsof implementation(using API's of
by using
lsof source code)
There are library routines for getting the type of information that
lsof normally provides from the kernel;
Where are these API in Mac10.3 ? because I am ok to patch my code in
every
release. It will be helpful to have APIs like libproc.h for
Mac10.5.x to get
the same information.
Since they are unstable and undocumented (and may be hidden)I cannot
get it
after googling, Please do let me know if there are such API to get the
Kernel information like list of open file descriptors and file name
etc.
Thank you,
Manish
-----Original Message-----
From: Terry Lambert [mailto:email@hidden]
Sent: Thursday, May 15, 2008 4:53 AM
To: Manish Chaturvedi
Cc: email@hidden
Subject: Re: Problem in reading struct file.
On May 13, 2008, at 2:29 AM, Manish Chaturvedi wrote:
Hi All,
I am Implementing my own lsof on Mac10.3.0 to get the list of open
files for process ( i.e. file descriptors, file name). Below is the
code snippet describing the problem.
There is no such thing as "struct file" in 10.3 (Tiger); there are
several legacy forward declarations of the struct for use by pointers
(which are not used), but there is no such thing.
You are probably getting this error because it's the error you get any
time you make a forward declaration of a structure with no
implementation behind it, and then try to declare an instance of it.
You'd get the same from attempting to compile:
struct Manish;
struct Manish ml;
int
main(int ac. char *av[])
{
return 0;
}
There are library routines for getting the type of information that
lsof normally provides from the kernel; they are considered unstable,
however, and we may change them with every release, but they are less
unstable than raw structure declarations. It's actually more stable
to popen lsof itself.
For the information that's there that lsof can't get via library
routines, there's dtrace.
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden