替代fstat? [英] alternative to fstat ?
问题描述
我有成千上万的文件需要检查其退出。
我认为fstat对此来说成本太高。
有没有更好的方法呢?
" solarisss" < sa ************** @ gmail.comschrieb im Newsbeitrag
新闻:d6 **************** ****************** @ s19g2000 prg.googlegroups.com ...
>我有成千上万的需要检查其出口的文件。
我认为fstat对此来说代价太高了。
有没有更好的方法呢?
OT这里,但在POSIX你会有stat()(这会省你fopen())
和访问权限()(这应该便宜很多,因为它不需要填写
整个结构数据)。
再见,Jojo
在文章< fj ********** @ online.de>中,
Joachim Schmitz< jo ** @ schmitz- digital.dewrote:
> OT在这里,但在POSIX你会有stat()(这会省你fopen())
和access()(它应该便宜得多,因为它不必填写
整个struct stat)。
我怀疑access()会显着便宜,因为它仍然需要
来进行系统调用并获取文件的inode。
- Richard
-
:wq
理查德托宾 < ri ***** @ cogsci.ed.ac.ukschrieb im Newsbeitrag
news:fj *********** @ pc-news.cogsci.ed.ac .uk ...
文章< fj ********** @ online.de>,
Joachim Schmitz< jo ** @ schmitz-digital.dewrote:
>> OT在这里,但在POSIX你会有stat()(其中会省你fopen())
和access()(这应该便宜得多,因为它不必填写
整个struct stat)。
我怀疑access()会显着便宜,因为它仍然需要
来进行系统调用并获取文件的inode。
我经常使用的系统便宜得多。
再见,Jojo
I have thousands of files whose exitence needs to be checked.
I think fstat is too costly for this.
Is there any better way for the same ?
"solarisss" <sa**************@gmail.comschrieb im Newsbeitrag
news:d6**********************************@s19g2000 prg.googlegroups.com...>I have thousands of files whose exitence needs to be checked.
I think fstat is too costly for this.
Is there any better way for the same ?OT here, but in POSIX you''d have stat() (which would save you the fopen())
and access() (which should be much cheaper as it doesn''t have to fill the
entire struct stat).
Bye, Jojo
In article <fj**********@online.de>,
Joachim Schmitz <jo**@schmitz-digital.dewrote:
>OT here, but in POSIX you''d have stat() (which would save you the fopen())
and access() (which should be much cheaper as it doesn''t have to fill the
entire struct stat).I doubt access() would be significantly cheaper since it still has
to do a system call and get the inode of the file.
-- Richard
--
:wq
"Richard Tobin" <ri*****@cogsci.ed.ac.ukschrieb im Newsbeitrag
news:fj***********@pc-news.cogsci.ed.ac.uk...In article <fj**********@online.de>,
Joachim Schmitz <jo**@schmitz-digital.dewrote:
>>OT here, but in POSIX you''d have stat() (which would save you the fopen())
and access() (which should be much cheaper as it doesn''t have to fill the
entire struct stat).
I doubt access() would be significantly cheaper since it still has
to do a system call and get the inode of the file.It is significantly cheaper on a system I frequently work with.
Bye, Jojo
这篇关于替代fstat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!