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: Wed, 14 May 2008 16:22:36 -0700
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