FW: Problem in reading struct file.
FW: Problem in reading struct file.
- Subject: FW: Problem in reading struct file.
- From: "Manish Chaturvedi" <email@hidden>
- Date: Thu, 15 May 2008 11:24:35 +0530
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