<div dir="ltr"><div>Hi,</div><div><br></div><div>  I was just checking of posix_getxattr code to debug of my one problem.I have found scope of improvement in </div><div>  this function to execute system call in better way.As of now function(posix_getxattr) is calling system </div><div>  calls (sys_lgetxattr) two times to get the value of xattr or in case of list of xattr it calls multiple times</div><div>  </div><div> 1) In first time it get the buffer size required to store the value.</div><div>     call &quot;size = sys_lgetxattr (real_path, key, NULL, 0);&quot;</div><div> 2) In second time it calls the sys_lgetxattr with buffer after allocate the buffer size</div><div>     sys_lgetxattr (real_path, key, value, size);</div><div><br></div><div>  In the same way function is calling for listxattr also.I think we can optimise it as like below</div><div>  declare buffer buf[8192](size can be double to this also)</div><div>  1) Call size = sys_lgetxattr (real_path,key,buf,8192)</div><div>  2) if size == -1 and errono == ERANGE then we need to call systemcalls in old way like above otherwise</div><div>     we don&#39;t need to do anything.</div><div> </div><div>  In the case of failure we need to call systemcall 3 times while buffer is more than our declared buffer</div><div>  size otherwise in most of the cases we need to call it only once.</div><div><br></div><div>    Please share your input on this, appreciate your input.</div><div><br></div><div>Regards</div><div>Mohit Agrawal</div></div>