Re: setattrlist() on FIFO files, sockets, character and block device files
Re: setattrlist() on FIFO files, sockets, character and block device files
- Subject: Re: setattrlist() on FIFO files, sockets, character and block device files
- From: Terry Lambert <email@hidden>
- Date: Wed, 10 Jun 2009 12:21:54 -0700
Since a picture is worth 1000 words, here is the per-process open file
table layout in Mac OS X:
Attachment:
per_process_open_file_table.pdf
Description: Adobe PDF document
For the file operations which are not indirected through the
operations vector, those operations tend ti operate either directly on
the FS namespace (e.g. things like directory operations, such as open,
create, etc.), or they operate on a vnode. A vnode is vended by a
filesystem type, and vnode operations on a vnode operate through the
type of the vnode, which is the FS type which vended it. For special
devices, even in HFS+, this will be bsd/miscfs/specfs; for fifos, this
will be bsd/miscfs/fifofs. Operations directed against a vnode in one
of these FS's go to these FS's, even if the vnode was looked up in the
HFS+ namespace.
Basically, this means that for these fg_types, you will be limited to
operations that are explicitly supported in *those* fs
implementations, or operations which operate on names (so, for
example, you would not be able to add a resource fork to a FIFO).
Also, it should be noted that for those operations NOT indirected
through the operations vector, or for with the fg_type is not
DTYPE_VNODE, there are often switch statements that only permit
specific DTYPEs to be operated upon, and they are operated upon with
implementation (subsystem) specific operations, rather than vi vn_*(),
vnode_*(), or VNOP_*() operations. This means not all operations are
going to work there.
-- Terry
On Jun 10, 2009, at 1:02 AM, Terry Lambert wrote:
For non-regular files, the filesystem is less willing to store the
information you are trying to set.
-- Terry
On Jun 9, 2009, at 9:22 PM, rohan a <email@hidden> wrote:
Hi Terry,
Thanks for the reply. However, I am using the HFS+
file-system. This supports all the attributes that I was trying to
set
to the object.
Thanks
On Wed, Jun 10, 2009 at 7:30 AM, Terry Lambert<email@hidden>
wrote:
On Jun 7, 2009, at 11:39 PM, rohan a wrote:
Hello All,
A setattrlist() call on a FIFO file, socket and
character/block device file fails with errno=0 (unknown error)?
Why does setattrlist() not work with these files?Also why does it
not
return a proper errno?
I am trying to set the following attributes:
BSD flags
creation time
text encoding hint
backup time
&
finder flags
The same works with all other files.
Another interesting thing here is that getattrlist() works fine
with
these file types
The setattrlist() API sets attributes on file system objects; you
can only
set the information about the object that the backing filesystem
is willing
to actually store; if you attempt to set more than that, you'll
get an
error. The getattrlist() API gets attributes from filesystem
objects;
minimally, it will return the same information that fstat() would
return to
you; if the backing FS supports more than that, and the
information exists,
and you request it, it will return more than that. What's
supported is on a
filesystem by filesystem basis, and is noted in the FS volume
attributes for
the volume in question.
Typically I recommend that you use Coca frameworks, rather than
calling
these APIs directly from your code, since it's very easy to make
mistakes
packing or unpacking the information.
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden