On Fri, Dec 30, 2011 at 12:50:47AM +0800, Liu Yuan wrote: > On 12/29/2011 11:01 PM, Christoph Hellwig wrote: > > > The right fix is to replace the attr/xattr.h include with sys/xattr.h, > > which is provided by glibc. > > > > > Looks that Farm uses it wrong. I include attr/xattr.h as man 2 getxattr > suggests. > > When I tried sys/xattr.h, I have to additionally manually change XNOATTR > into *XNODATA* or meet an compile error. > > So, I just wonder which is right way to use getxattr/setxattr system > call? If we are supposed to use sys/xattr.h, I think there is some > manual accessible to tell that we might have to use XNODATA instead of > XNOATTR for error check. Do I miss anything? Given that Linux doesn't have the ENOATTR error code I'd suggest to simply not use it. It's left in libattr as a porting aide for code from IRIX that had it. But only the libattr highlevel interface from <attr/attributes.h> is portable anyway, so using it for the lowlevel Linux interface doesn't make a whole lot of sense. |