confusion on fopen()/falloc()
yanyu at CS.UCLA.EDU
Sat Feb 26 09:12:22 GMT 2005
On Sat, 26 Feb 2005, Yan Yu wrote:
> Hello, all,
> I have a user program as below:
> FILE *fd;
> while (1)
> fd= fopen( "tmp", "r" );
> if ( fd == NULL )
> from my understanding, since i open the same file to read, my process
> should create a new file descriptor each time when fopen is called.
> Therefore, inside the kernel, fdalloc() should be called, NOT falloc()
> (since falloc() allocates a new FILE * struct in addition to a new file
oops, what i really meant is a new FILE struct...
> BUT based on what i observed (i instrumented falloc() function), it seems
> that falloc() is called each time when fopen() is called.
> I am wondering where i missed?
> Any hints is appreciated!
More information about the freebsd-hackers